MySQL: Access denied for user 'root' @ 'localhost'

Source: Internet
Author: User

After the system is reinstalled today, after MySQL is installed and started with sqlyogent, the system prompts "Access denied for user 'root' @ 'localhost' (using password: Yes )", I started to find out the root permission problem because of a password problem. I thought it may be because I did not use the Administrator identity to install Windows 7, therefore, the root role does not have the permission. I found a solution from the Internet and recorded it here:

1. log on to the system as an administrator, stop the MySQL service, or end the mysqld-nt process;
2. Enter the command line and go to the MySQL installation directory. Assume that the installation directory is D: \ mysql \, and CMD enter the command line;
3. run D: \ Program Files \ mysql server 5.5 \ bin \ mysqld-NT -- skip-grant-tables to start MySQL and disable permission check; (I changed mysqld-nt to mysqld)
4. run D: \ Program Files \ mysql server 5.5 \ bin \ mysqladmin-u root flush-Privileges password "newpassword" to reset the root password. (I run another cmd)
5. Restart the MySQL service;

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.