Home > Database > Mysql Tutorial > How to use the MySQL command line to change the MySQL login password

How to use the MySQL command line to change the MySQL login password

coldplay.xixi
Release: 2020-10-29 16:15:03
Original
5880 people have browsed it

How to use the MySQL command line to modify the MySQL login password: First log in to the mysql database; then enter the command [mysql>SET PASSWORD = PASSWORD('aa')]. If the set password is empty, you can write [mysql>SET PASSWORD = '';】.

How to use the MySQL command line to change the MySQL login password

How to change the MySQL login password using the MySQL command line:

Method 1:

mysql admin -u用户名 -p 旧密码 password 新密码
Copy after login

          'u' is the abbreviation of username,

        'p' is the abbreviation of password.

Method two:

This first records mysql database

# and then enter:

      mysql>SET PASSWORD = PASSWORD('aa');
Copy after login

At this time, the password for logging in to MySQL database has been. Change to 'aa'.

If the password is empty, you can write like this:

     mysql>SET PASSWORD = '';
Copy after login

At this time, the password to log in to the mysql database has been set to no password. You can log in directly without entering the password.

Method 3:

# and then enter:

 mysql>set password for root@localhost = pasword('aa'); 。
Copy after login

At this time, the password for logging in to MySQL database has been. Change to 'aa'.

If the password is empty, you can write like this:

         mysql>set password for root@localhost = '';
Copy after login

At this time, the password to log in to the mysql database has been set to no password. You can log in directly without entering the password.

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of How to use the MySQL command line to change the 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