[Baidu experience] connection to mysql in window: Error Code 1045 and mysql1045

Source: Internet
Author: User

[Baidu experience] connection to mysql in window: Error Code 1045 and mysql1045

Error Code 1045 Access denied for user 'root' @ 'localhost' (using password: YES)

Baidu experience: jingyan.baidu.com

Method/step
  1. 1

    Find the configuration file my. ini and open it.

    In my computer, the path of my. ini is: (D: \ MySQL Server 5.6 ). If the path cannot be found, you can use the Everything software to find the location of the configuration file.

  2. 2

    Search for the mysqld keyword, find it, add skip-grant-tables under mysqld, save and exit.

  3. 3

    Restart mysql (Control Panel \ All control panel items \ management tools \ Services find mysql, right-click-> restart)

  4. 4

    Then run cmd to switch to the mysql bin directory (The following is the mysql path on my computer)

    > D:

    > Cd d:/MySQL Server 5.6/bin

  5. 5

    Enter the database and reset the password

    Mysql> mysql-u root-p Enter

    No need to worry about password Enter

    Mysql> use mysql Enter

    Mysql> update user set password = password ("new password") where user = "root"

    Mysql> flush privileges refresh the database

    Mysql> quit

  6. 6

    Modify my. ini, comment out or delete skip-grant-tables (in case of a problem next time), save and quit

  7. 7

    Restart the MySQL service (step 3)

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.