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.
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 -p
Specify the root user to log in to MySQL, and press the Enter key to enter the 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:
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!