An error occurred connecting to the MySQL database: Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Source: Internet
Author: User

When you re-pick up the MySQL database, the first time you connect to the database, you get access denied for user ' root ' @ ' localhost ' (using Password:yes) error. Check the relevant information, found that the root account is not open by default remote access permissions, so need to modify the relevant permissions. You can do the following workaround.

    1. Open the My.ini file in the MySQL directory, add a line "Skip-grant-tables" at the end of the file, and save and close the file.
    2. Restart the MySQL service.
    3. Enter the MySQL bin directory via the command line, type "Mysql-u root-p" (without entering the password) and enter the database.
    4. Execute "use MySQL;", using MySQL database.
    5. Execute "Update user set Password=password (" 123456 ") where user= ' root ';
    6. Open the My.ini file in the MySQL directory, delete the last line of "Skip-grant-tables", save and close the file.
    7. Restart the MySQL service.
    8. You can successfully connect to the database by entering "Mysql-u root-p 123456" on the command line.

An error occurred connecting to the MySQL database: Access denied for user ' root ' @ ' localhost ' (using Password:yes)

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.