I'm pulling my hair out trying to decipher why every time I do a fresh install of mysql on OSX and import a database, the minute I restart the mysql instance I'm prompted with the message: Access denied for user 'root'@'localhost' (using password: YES). I've kept the password to defaulted root, and this is quit frustrating. I've tried my hardest to ensure no other instances of mysql are running. The Activity monitor reports no other instances of mysql, and when searching for pids no other instances appear. Does anyone know what is happening?
This error can occur when you import SQL tables that contain the MySQL database itself, this database contains the underlying schema that MySQL itself uses, this can cause serious issues when attempting to get into the database. Make sure that your imported SQL dump only includes the database you wish to import and nothing more.
This error could occur in the following cases:
Using an incorrect password. Since you mentioned that you have defaulted the password to root, check if you have the CAPS lock on.
It could occur if you have an incorrect password specified in an option file. Try logging in using:
mysqladmin --no-defaults -u root -p pass
You might have to grant access to root.
Start MYSQL skippping grants:
/usr/sbin/mysqld --skip-grant-tables --skip-networking &
mysql -u root
SET PASSWORD FOR root@'localhost' = PASSWORD('password'); UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';