Host "localhost" is not allowed to connect to MySQL Server Solution

Source: Internet
Author: User

I. Reasons:

When I tried to initialize a web application today, I found that it could not connect to MySQL. From traceback, the default password is yes '. No, I tried to change the MySQL password to 'yes'. I am crazy. Where is any key...

Use MySQL Update uesr SET Password = 'yes' where user = 'root' and host = 'localhost '; Flush privileges; after you exit the console, you cannot enter it again. Mysql-u root-P Mysql-H localhost-u root-P does not work, and an error occurs: "Host 'localhost' is not allowed to connect to this MySQL server." 2. Stop the MySQL service first: SC stop MySQL then: Mysqld -- skip-grant-tables open another terminal and continue Mysqlcheck -- check-upgrade -- all-databases -- auto-repair and then input MySQL is ready to go to the MySQL console. In this way, when you use the SELECT statement, you will find that the password uses plain text: 'yes'. Haha, I am really crazy. 3. After the problem is resolved to the console, account maintenance cannot be performed. The correct method is: Mysql-u root then uses the following statement to restore the password to the root hash value: Update uesr SET Password = PASSWORD ('yes') where user = 'root' and host = 'localhost '; Then, the mysqld -- skip-grant-tables command seems to be only available locally.

If the MySQL service cannot be stopped normally, run the command mysqladmin-u root shutdown.

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.