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 change the MySQL login password using the MySQL command line:
Method 1:
mysql admin -u用户名 -p 旧密码 password 新密码
'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');
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 = '';
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'); 。
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 = '';
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!