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.