Access denied for user ' root ' @ ' localhost ' (using Password:yes) (can be resolved correctly)

Source: Internet
Author: User

This article is about MySQL error: Access denied for user ' root ' @ ' localhost ' (using password:yes) solution, the interested classmate reference.

Note: The place to add red is the focus


Error description

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Solution Solutions

Windows environment

Edit the MySQL configuration file My.ini (do not know where to search), add skip-grant-tables under the [mysqld] entry

Restart MySQL after saving exit

1. Click "Start", "Run" (shortcut key Win+r).

2. Start: Enter net stop MySQL

3. Stop: Enter net start MySQL

CMD mysql-u root-p Enter

If you report that MySQL is not an executable command under CMD, your MySQL is not added to the environment variable, please automatically CD to the bin directory of the MySQL installation directory and then perform mysql-u root-p carriage return

1. Go to 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. Refreshing the database
mysql> flush Privileges;

4. Exit MySQL:
Mysql> quit

Modify My.ini This file, we just joined the "skip-grant-tables" This line delete, save exit and restart MySQL can be

Access denied for user ' root ' @ ' localhost ' (using Password:yes) (can be resolved correctly)

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.