MYSQL forgot the superuser password change, mysql User Password Change
# Service mysql stop # mysqld_safe -- skip-grant-tables another SSH connection or terminal [root @ localhost ~] # Mysqlmysql> use mysqlmysql> update user set password = password ("123456") where user = "root"; mysql> flush privileges; mysql> exit
Then, when you enter mysql again, you need to set the password again.
SET PASSWORD=PASSWORD('123456')
This works.
How can I change the root password of a mysql Super User?
I have seen how to overwrite key files.
On the Linux platform, I forgot the MySql superuser management password. How can I change the password and regain control?
1. Stop the MYSQL service first
# Service mysql stop
2. It is difficult to run and skip permissions in mysql Security Mode
# Mysqld_safe -- skip-grant-tables
3. Use root to log on. No Password is required.
# Mysql-u root
4. Change the password now
Mysql> use mysql;
Mysql> update user set Password = PASSWORD ('your newpassword') where User = 'root ';
Mysql> exit
Note: When 'mysqld_safe -- skip-grant-tables 'is run, it stops at 'starting mysqld daemon with databases from/var/lib/mysql'. You can start a remote terminal and continue the operation.
Reference: hi.baidu.com/...9.html