您的位置:首页 > 数据库 > MySQL

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

2015-08-31 11:17 856 查看
让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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息