This article describes how to change the password of mysql and how to enable remote logon. For more information, see root.
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-pEnter 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 statusmysqld 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 &
The above is all the content of this article. I hope you will like it.