Access denied for user ' root ' @ ' localhost ' (using password:yes) workaround

Source: Internet
Author: User
Tags deprecated mysql in

In the course of MySQL use, we may encounter "Access denied for user ' root ' @ ' localhost ' (using password:yes)" problem, then we will solve it.

After my Baidu query finally concluded: There are two possible errors, one is the root of the MySQL user password error, and the second is insufficient authority problem. The usual solution is to change the password ...

Because I am using a Windows system, the method is also a modified method for Windows systems:

1, start → search bar input cmd→ Right Cmd.exe choose to run as administrator (you can also find this cmd.exe in the C:\Windows\System32 directory, right-click, run as Administrator)

2. Input net stop MySQL stop MySQL service

3, enter the command line to the MySQL bin directory, enter the following bold command

d:\mysql\bin>mysqld--defaults-file= "d:\mysql\my.ini"--console--skip-grant-tables

  Wait a minute, show the following results illustrate MySQL boot:

22:26:09 [Warning] The syntax '--log ' is deprecated and'll be removed Inmysql 7.0. Please use '--general_log '/'--general_log_file ' instead.
22:26:09 [Warning] The syntax '--log_slow_queries ' is deprecated and'll be removed in MySQL 7.0. Please use '--slow_query_log '/'--slow_query_log_file ' instead.
22:26:09 [Warning] The syntax '--log ' is deprecated and'll be removed in MySQL 7.0. Please use '--general_log '/'--general_log_file ' instead.
22:26:09 [Warning] The syntax '--log_slow_queries ' is deprecated and'll be removed in MySQL 7.0. Please use '--slow_query_log '/'--slow_query_log_file ' instead.
22:26:09 [ERROR] The update log is no longer supported by MySQL in version 5.0 and above. It is replaced by the binary log. Now starting MySQL with--log-bin= ' instead.
22:26:09 innodb:started; Log sequence number 0 324221
22:26:09 [Note] mysqld:ready for connections. Version: ' 5.1.33-community-log ' socket: ' port:3306 MySQL Community Server (GPL)

4, and then as an administrator to open a Cmd.exe, enter the command line to the MySQL bin directory, enter:mysql-uroot mysql

  5. After entering MySQL, enter the command line to change the password:

mysql>Update user set Authentication_string=password (' 123456 ') where user= ' root ';

6, Refresh permissions:mysql>flush privileges;

7, quit MySQL:mysql> quit;

8. Close mysql:d:\mysql\bin>mysqladmin shutdown (Error: Mysqladmin-uroot-p shutdown and enter new password)

  9, at this point to modify the password to complete, you can enter the command line:net start mysql start MySQL service,mysql-uroot-p , enter the password can enter MySQL.

Access denied for user ' root ' @ ' localhost ' (using password:yes) workaround

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.