This article introduces the solution to the mysql startup prompt accessdeniedforuserroot @ localhost (usingpassword: YES). For more information, see this article.
This article introduces the solution to the mysql startup prompt "access denied for user root @ localhost (using password: YES)". for more information, see this article.
The key is: Access denied for user 'root' @ 'localhost' (using password: YES )'
From the error, we can see that your permission is not granted to access localhost.
You can use the following command to release the permission:
Solution
1. log on to the system as an administrator, stop the mysql service, or end the mysqld-nt process;
2. go to 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 FilesMySQLMySQL Server 5.5binmysqld-nt -- skip-grant-tables to start mysql and disable permission check;
4. run D: Program FilesMySQLMySQL Server 5.5 binmysqladmin-u root flush-privileges password "newpassword" to reset the root password;
5. restart the mysql service;
Command-based solution
Method 1:
The code is as follows: |
|
#/Data/mysql/bin/mysqladmin-u-p <首先要停止你之前的启动的mysql.如果停止的时候.也出现1045的错误的话那只有kill掉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: <输入新设的密码newpassword> Mysql> |
Solution 2
First, it is included in the mysql client command line.
Then
The code is as follows: |
|
Grant all privileges on *. * to 'root' @ 'localhost' identified by 'Your password' with grant option; Flush privileges; |
After the two commands are executed, you can