Home  >  Article  >  Database  >  How to change mysql login password

How to change mysql login password

青灯夜游
青灯夜游Original
2022-04-14 20:03:425372browse

Modification method: 1. Open the cmd command window, execute the "mysql -u root -p" command and enter the password, log in to mysql with root privileges; 2. Execute "set password for username@localhost=password( "New password");" command to change the password.

How to change mysql login password

The operating environment of this tutorial: windows10 system, mysql5.7.29 version, Dell G3 computer.

When using the database, we may encounter situations where MySQL needs to change the password, such as the password is too simple and needs to be changed, etc.

How to modify mysql login password

Prerequisite: Log in to mysql with root permissions and modify ordinary users

Steps:

1. Open the cmd command window and execute the command mysql -u root -pSpecify the root user to log in to MySQL, and press the Enter key to enter the password.

How to change mysql login password

2. Use SET PASSWORD to change the password

The command format is:

set password for username@localhost = password(newpwd);

whereusername is the user name whose password you want to change, newpwd is the new password you want to change.

As shown in the figure:

How to change mysql login password

Next enter the quit; command to exit MySQL and log in again, you can use the new password "root"Log in!

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to change mysql login password. 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