#1045-Access denied for user 'root' @ 'localhost'

Source: Internet
Author: User

In Windows, the solution is as follows:

1. net stop MySQL Stop Service

2. Modify the my. ini file in the $ {mysql_home}/MySQL Server 5.1 directory.

[Mysqld] Add the following sentence:
Skip_grant_tables

3. Add your $ {mysql_home} \ bin directory to the path

4. Net start MySQL Service

5. mysql-uroot-P
Enter Password: Root

6. use MySQL;

Mysql> Update user SET Password = PASSWORD ('root') where user = 'root ';
Mysql> flush privileges;
Mysql> exit

7. Delete this sentence in my. ini: skip_grant_tables
Net stop MySQL
Net start MySQL

8. You can log on.

Mysql-uroot-proot
Mysql>

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.