Tip: Error 1044 (42000): Access denied for user ''@ 'localhost' to database 'mysql '. This problem also occurred two days ago. I found a popular method on the Internet (see method 1. I tried this again today, but I was not sure. After searching for it online for half a day, I finally found that there is an account with a blank username in the User table of the MySQL database, that is, an anonymous account, root is used for logon, but Anonymous logon is actually performed. You can see the '@ 'localhost' in the error message. For the solution, see method 2.
Method 1:
1. Disable MySQL
# Service mysqld stop
2. Block Permissions
# Mysqld_safe -- skip-grant-table
The screen displays: Starting demo from .....
3. Start a new terminal Input
# Mysql-u root MySQL
Mysql> Update user SET Password = PASSWORD ('newpassword') where user = 'root ';
Mysql> flush privileges; // remember this sentence. Otherwise, if you close the previous terminal, the original error will occur.
Mysql> \ q
Method 2:
1. Disable MySQL
# Service mysqld stop
2. Block Permissions
# Mysqld_safe -- skip-grant-table
The screen displays: Starting demo from .....
3. Start a new terminal Input
# Mysql-u root MySQL
Mysql> Delete from user where user = '';
Mysql> flush privileges; // remember this sentence. Otherwise, if you close the previous terminal, the original error will occur.
Mysql> \ q
Post: http://blog.csdn.net/tys1986blueboy/article/details/7056835
After installing the mysql-5.6.11-osx10.7-x86_64 on the MacBook Pro, the root user could not see the MySQL database. After following the method 2 above, you can.