Error 1044 (42000): Access denied for user "@ 'localhost' to database' MySQL &

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.