Access denied for user & #39; root & #39; @ & #39; localhost & #39; (using password: YES) (correct solution), deniedlocalhost

Source: Internet
Author: User

Access denied for user 'root' @ 'localhost' (using password: YES) (correct solution), deniedlocalhost

This article describes the mysql error: Access denied for user 'root' @ 'localhost' (using password: YES) solution. for more information, see.

Note: Red is the focus


Error description

ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)

Solution

Windows Environment

Edit mysql configuration file my. ini (do not know where to search), add skip-grant-tables under [mysqld]

Save and exit and restart mysql

1. Click Start> Run (shortcut: Win + R ).

2. Start: Enter net stop mysql

3. Stop: Enter net start mysql

Cmd mysql-u root-p press ENTER

If mysql is not an executable command in cmd, it indicates that your mysql is not added to the environment variable, please automatically cd to the bin directory of the mysql installation directory and then run mysql-u root-p press ENTER

1. Enter the mysql database:

Mysql> use mysql;

2. Set a new password for the root user:
Mysql> update user set password = password ("new password") where user = "root ";

3. Refresh the database
Mysql> flush privileges;

4. Exit mysql:
Mysql> quit

Modify the my. ini file, delete the "skip-grant-tables" line we just added, save and quit, and restart mysql.

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.