Password changes and erasure for mysql root users

  • 2020-05-07 20:33:33
  • OfStack

Password change: use the mysqladmin command

1. For example, if your root user does not have a password and you want the password to be changed to abc, the command is mysqladmin-u root password abc

2. If your root now has a password, the command to change it to abc is mysqladmin-u root-p password youyou
Note that the command enter will ask you for the old password, after entering the old password command completed, password changed successfully.
2. Password elimination

1. Login with root: mysql-u root-p

2, mysql > use mysql;

3, mysql > update user set password='' where user='root';
Just restart the mysql service


Related articles: