Home > Database > Mysql Tutorial > How to change mysql login password

How to change mysql login password

青灯夜游
Release: 2022-04-14 20:03:42
Original
5462 people have browsed it

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template