Forget the original root password of myql
1. Have the original root password for myql;
Method 1:
Outside the mysql system, use mysqladmin
# Mysqladmin-u root-p password "test123"
Enter password: [Enter the original password]
Method 2:
Log on to the mysql system,
# Mysql-uroot-p
Enter password: [Enter the original password]
Mysql> use mysql;
Mysql> update user set password = passworD ("test") where user = 'root ';
Mysql> flush privileges;
Mysql> exit;
2. Forget the original root password of myql;
First, you must have the root permission of the operating system. If you do not have the root permission of the system, consider the root system and then follow the steps below.
Similar to logging on to the system in safe mode, it is recommended that you use pkill mysql, but I do not recommend it. Because when you execute this command, it will lead to the following situation:
/Etc/init. d/mysqld status
Mysqld dead but subsys locked
In this way, even if you start mysql in safe mode, it may not be useful. d/mysqld stop. If you use pkill, start and stop again.
# Mysqld_safe -- skip-grant-tables &
&, Indicating that it is running in the background. If it is no longer running in the background, open another terminal.
# Mysql
Mysql> use mysql;
Mysql> UPDATEuserSETpassword = password ("test123") WHEREuser = 'root ';
Mysql> flush privileges;
Mysql> exit;
# Mysql is case-insensitive, but this is the specific value of the modified mysql database. Note that.