MySQL Mysql root user account password reset

Reset Mysql root user account password

By: grant customer QQ : 1033553122

 

 

Problem Description:

The following error message appears when using mysqladmin.exe execute the command:

mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'

 

Solution

Following reset mysql root user password

# service mysqld stop

 

# Mysql installation into the directory / bin directory (if the configuration relating environment variables not performed, the operation proceeds to below this directory are first re-execute), the following

# Mysqld_safe --skip-grant-tables # start mysql

 

In addition a new console, execute the following command

# Mysql -uroot -p Enter into the mysql console

> use mysql;

> Update user set password = password ( "123456") where user = "root"; # change the root password is 123456

> flush privileges;  

> quit

 

# service mysqld restart

# Mysql -uroot -p123456 # Login

 

 

Annex: linux xampp integrated environment mysql root password reset method

 

1, stop mysql server

sudo / opt / lampp / lampp stopmysql

 

2, using the `--skip-grant-tables' parameter to start mysqld

sudo /opt/lampp/sbin/mysqld --skip-grant-tables

 

3, then create a shell terminal, execute the following command

sudo / opt / lampp / bin / mysql -uroot # command execution is completed, it will directly enter the mysql command console

 

4, connect mysql database permissions

use mysql;

 

5, change the root password

update user set password=password("123456") where user="root";

 

Note: 123456 Here is the new password to be set for the root user

 

6, refresh authority table

flush privileges;

 

7, exit mysql

quit;

 

8, restart the mysql service

sudo / opt / lampp / lampp startmysql

 

9, restart XAMPP

/opt/lampp/./lampp restart

Guess you like

Origin www.cnblogs.com/shouke/p/11515722.html