Django can't destroy and create test databases properly

萝らか妹 提交于 2019-12-04 13:14:14

I have finally found the reason.

Our application has around 7 databases. When I was about to drop them manually to get a clean state, I accidentally also dropped the mysql database. This database should not be ever deleted, as it contains vital information about the root user.

When I realised this, I tried to mitigate by reinstalling MySQL via brew.

brew uninstall mysql
brew install mysql

This worked and mysql database showed up again when I ran show databases;, however the problem persisted. Thats when I came here for help.

As it seems things are a bit more complicated than that with brew. This is how I got it working again:

1) brew uninstall mysql
2) sudo rm -r /usr/local/var/mysql/
3) brew install mysql
4) unset TMPDIR
5) mysql_install_db --verbose --user='whoami' --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
6) mysql.server restart
7) mysql_secure_installation

Now it works. Hope this helps other fellow mac users. Thanks.

Well, there are two errors indicating that the mysql.proc table is missing. You might be able to generate it running mysql_update.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!