当前位置:Gxlcms > 数据库问题 > mysql 里对root及普通用户赋权及更改密码的一些命令

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

时间:2021-07-01 10:21:17 帮助过:41人阅读

让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 里对root及普通用户赋权及更改密码的一些命令

标签:localhost   password   identified   mysql   更改密码   

人气教程排行