Article Directory
System version : CentOS Linux Release 7.7.1908 (Core)
MySQL Version : 5.6.47 MySQL Community Server (GPL)
First, the linux system MySQL forgotten password solution
1. Stop the mysql service process
service mysqld stop
2. Edit the MySQL configuration file my.cnf
vim /etc/my.cnf
3. Restart MySQL service
systemctl restart mysqld
4. Log database, execute the following command
mysql -u root
use mysql;
update user set password=password("test12") where user="root";
flush privileges;
# 注意:test12 这里是我设置的密码,在这里自定义即可。
5. Restart the database (to be restarted)
systemctl restart mysqld
6. Use the new password
mysql -u root -ptest12
note:-P password behind with no spaces, or in accordance with the table search, will complain
Second, if you do not know your root password
Click here to see this ...... solutions have access to the device can be resolved