ERROR1044 (42000): accessdeniedforuser'' @ 'localhost' _ MySQL

Source: Internet
Author: User
ERROR1044 (42000): Accessdeniedforuser bitsCN.com
ERROR 1044 (42000): Access denied for user ''@ 'localhost' to database 'mysql' solution: 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 stop2. block permission # mysqld_safe -- skip-grant-table: Starting demo from ..... 3. start a new terminal and enter # mysql-u root 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 mysql>/q Method 2 will appear: 1. disable mysql # service mysqld stop2. block permission # mysqld_safe -- skip-grant-table: Starting demo from ..... 3. start a new terminal and enter # mysql-u root mysql> delete from user where USER = ''; mysql> flush privileges; // Remember this sentence, otherwise, if you close the previous terminal, the original mysql>/q
BitsCN.com

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.