MySQL error code #1045 Access denied for user ' root ' @ ' localhost '

Source: Internet
Author: User

Encountering MySQL "error code #1045 access denied for user ' root ' @ ' localhost ' (using Password:yes)" requires a password to reset the root account, this is generally not very good solution.

However, these days debugging really encountered this problem, can not skip, must be resolved in the local debugging program source code, no way, a little solution.

Fortunately, the situation of this kind of problem, a lot of people, so many move off-the-shelf, as long as it can solve the problem on the line.

Method:

1th, stop the MySQL service, CMD Open the dos window, enter "net stop MySQL", but sometimes do not stop is indifferent;

2nd, in the CMD Command Line window, go to the MySQL installation directory such as "E:\APMServ5.2.6\MySQL5.1\bin" (I use Apmserver)

Such as:

3rd, in the 2nd Command window, enter the command as: "Mysqld-nt--skip-grant-tables"

The function is to enter the MySQL security mode, that is, when MySQL gets up, you can enter the database without entering a password.

This time can enter the database, to their own database reset password on it!

If you still get a 1045 error, continue with the following actions

1. Reopen a CMD command-line window, enter: "Mysql-uroot-p", use a blank password to log in to MySQL (Do not enter the password, directly press ENTER)

2. Enter the following command to start modifying the root user's password (note: there is a "dot" in the middle of the command "Mysql.user")

"Mysql>update Mysql.user set Password=password (' New password ') where user= ' root ';

3. Refresh the Permissions table

"Mysql>flush Privileges"

4. Exit: "Mysql>quit"

Get it done, retire!


Welcome reprint, Ly Inn-Kang Jianjun-blog: MySQL error code #1045 Access denied for user ' root ' @ ' localhost ', reproduced please specify the original URL: http://blog.lykezhan.com/jishu/ Biji/2017/0319/224.html

MySQL error code #1045 Access denied for user ' root ' @ ' localhost '

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.