MySQL startup prompts access denied for user root@localhost (using Password:yes) Solution Summary

Source: Internet
Author: User
Tags flush

The key is to see: Access denied for user ' root ' @ ' localhost ' (using Password:yes) '

From the error you can see that your permission is not open to the localhost access.
You can then use the following command to release permissions:

Solutions

1. Admin login system, stop MySQL service or end mysqld-nt process;

2. Go to the command line and come to MySQL's installation directory. Suppose the installation directory is d:mysql, cmd enter the command line;

3. Run D:program filesmysqlmysql Server 5.5binmysqld-nt--skip-grant-tables start MySQL, turn off the check of permissions;

4. Run D:program filesmysqlmysql Server 5.5binmysqladmin-u root flush-privileges password "newpassword" to reset the root password;

5. Restart the MySQL service;

The way the order is resolved

Method One:

The code is as follows Copy Code

#/data/mysql/bin/mysqladmin-u-P < First stop MySQL before you start. And if it stops. There are also 1045 errors that only kill the MySQL pid>
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
# mysql-u Root MySQL
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit

#/etc/init.d/mysql Restart
# mysql-uroot-p
Enter Password: < Enter the new password newpassword>

Mysql>

Workaround Two

First, the client command line to MySQL is counted.

And then

The code is as follows Copy Code

Grant all privileges in *.* to ' root ' @ ' localhost ' identified by ' your password ' with GRANT option;

Flush privileges;

That's all you have to do when you're done with these two commands.

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.