Mysql用户密码管理

  • Update语句:
mysql> update mysql.user set authentication_string=password('mysqlzuo123')
    -> where user='test2' ;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
  • Set Password语句:
mysql> set password for 'test2'@'localhost' = password('123');
Query OK, 0 rows affected (0.00 sec)
  •  Grant Usage语句:
mysql> grant usage on *.* to 'test2'@'localhost' identified by '321' ;
Query OK, 0 rows affected (0.01 sec)

#不影响用户权限的基础上修改用户密码。

  • 也可用Insert语句、Grant语句创建用户时直接指定密码

猜你喜欢

转载自blog.csdn.net/qq_42254088/article/details/81480955