Home  >  Article  >  Database  >  How to change password in MySQL5.7.18

How to change password in MySQL5.7.18

小云云
小云云Original
2018-01-13 16:44:562273browse

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

(note that you need to modify it yourself Installation path)


3. Open another dos window and enter

mysql -uroot -p

, 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;

5. Open the MYSQL server! ! ! You can open it manually or enter net start mysql in cmd.


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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn