Reputation: 44293
I can't seem to figure out what I have to do in order to install/setup mysql correctly on my new mac.
1.) I installend mysql via homebrew
2.) I'm able to run mysql.server start
3.) If I try to run mysql -u root -p
I get this
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I googled and looked through all kind of sources, but can't seem to figure out what to do.
Update:
Update 2:
Upvotes: 10
Views: 1065
Reputation: 142278
"No" password and password = '' are different things.
For "no" password:
mysql -u root
For '':
mysql -u root -p
and then enter empty line when prompted
mysql -u root -p root
with a space between -p and root means: (1) prompt for password, then (2) USE root
to establish the default database.
mysql -u root -proot
without a space says "my password is 'root'".
Upvotes: 2
Reputation: 15530
Let's stop mysqld:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Clean re-installation procedure:
brew remove mysql
brew cleanup
brew doctor
Backup your database before do next step. Then clean data directory up (to avoid manual run extra step mysql_install_db later):
sudo rm -rf /usr/local/var/mysql
The latest step is to install it again from scratch:
brew update
brew install mysql
Then run mysqld and try to login to CLI:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql -u root
Upvotes: 6