mysql 里对root及普通用户赋权及更改密码的一些命令

让root用户可以通用 Navicat for MySQL客户端登录:


mysql> grant all privileges on *.* to root@'%' identified by 'root';

Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


对user1用户更改密码,权限有点大,但不执行下面的第一条命令,密码改不了。

mysql> grant all privileges on *.* to user1@'localhost' identified by '123456';

Query OK, 0 rows affected (0.00 sec)


mysql> set password for user1@localhost=password('123456');

Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


你可能感兴趣的:(mysql,localhost,password,identified,更改密码)