This article mainly introduces the method of changing the password in MySQL5.7.18. It is very good and has reference solution value. Friends in need can refer to it. I hope it can help everyone.
How to change the password in MySQL 5.7.18:
1. First close the MySQL server:
You can close it directly in the task manager, or you can close mysql in cmd :net stop mysql
2. Turn on the safe mode and log in without a password: jump to the installation directory in cmd: d: ##Then enter:
mysqld --defaults-file="D:\Mysql\mysql-5.7.18-winx64\my.ini" --console --skip-grant-tables
3. Open another dos window and enter
, and then enter directly without entering a password; 4. Next open it mysql database: use mysql;
Then enter update mysql.user set authentication_string=password('new password') where user='root'; Then refresh the permissions: flush privileges;
Then exit :quit;
6. Then you can log in with the new password.
The above is the method of changing the password in MySQL 5.7.18 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the Script House website!
The above is the detailed content of How to change password in MySQL5.7.18. For more information, please follow other related articles on the PHP Chinese website!