For some reason MySQL stopped giving access for root. Uninstalled and reinstalled with Homebrew. Fresh install, fresh tables but when I enter
mysql -u root -
I had the same problem a couple days ago. It happens when you install mysql
via homebrew
and run the initialization script (mysql_install_db
) before starting the mysql
daemon.
To fix it, you can delete mysql
data files, restart the service and then run the initialization script:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm -r /usr/local/var/mysql/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp