当前位置:网站首页>Linux changes the MySQL password after forgetting it

Linux changes the MySQL password after forgetting it

2022-06-11 12:03:00 java-zh

1、 close mysql service

service mysqld stop


2、 find my.cnf The configuration file

whereis my.cnf

3、 stay [mysqld] Add under label :skip-grant-tables

vim /etc/my.cnf

4、 start-up mysql service

service mysqld start

5、 Login without password mysql, Enter directly after executing the following command

mysql -u root

6、 Use... In the database mysql library

use mysql;

7、 perform sql Update the password

update user set password=password(‘ Your new password ’) where user=‘root’; 

 8、 Refresh

flush privileges;

9、 Exit after modification

exit

 9、 stop it mysql service

service mysqld stop

10、 Get rid of my.cnf Inside skip-grant-tables Content

vim /etc/my.cnf

11、 start-up mysql service

service mysqld start

12、 Log in

mysql -u root -p

原网站

版权声明
本文为[java-zh]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111143283679.html