Home > Database > Mysql Tutorial > Change password using MySQL command line

Change password using MySQL command line

高洛峰
Release: 2016-12-20 09:43:43
Original
1092 people have browsed it

Through the MySQL command line, you can modify the password of the MySQL database. The following is a detailed introduction to the MySQL command line. If you are interested, you may wish to take a look.

 Format: mysqladmin -u username -p old password password new password

  1. Add a password ab12 to root. First, enter the directory mysqlbin under DOS, and then type the following command

 mysqladmin -u root -password ab12

 Note: Because root does not have a password at the beginning, the -p old password item can be omitted.

 2. Change the root password to djg345.

 mysqladmin -u root -p ab12 password djg345

  (Note: Unlike the above, the following are commands in the MYSQL environment, so they are followed by a semicolon as the command terminator)

  3. Modify root on the command line Password:

  mysql> UPDATE mysql.user SET password=PASSWORD('New Password') WHERE User='root';

  mysql> FLUSH PRIVILEGES; );

For more articles related to using the MySQL command line to change passwords, please pay attention to 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