本篇文章主要介绍了"企业是怎么给MYSQL赋予用户权限",主要涉及到方面的内容,对于其他数据库感兴趣的同学可以参考一下:
MYSQL创建用户及赋予用户权限运维人员常用的方法:mysql> grant all on xiaohu.* to 'qiqi@localhost' i...
MYSQL创建用户及赋予用户权限
运维人员常用的方法:
mysql> grant all on xiaohu.* to 'qiqi@localhost' identified by '123.com';
库.表
Query OK, 0 rows affected (0.01 sec)
grant语法
grant all privileges on dbname.* to user@localhost identified by 'password'
比如创建boy的用户,对qiqi库具备所有权限,允许从localhost主机登录管理数据库,密码是123.com
mysql> grant all privileges on qiqi.* to boy@localhost identified by '123.com';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; 刷新权限
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;
+----------------+-----------------+
| user | host |
+----------------+-----------------+
| qiqi@localhost | % |
| root | 127.0.0.1 |
| | localhost |
| boy | localhost |
| root | localhost |
| | master.test.com |
| root | master.test.com |
+----------------+-----------------+
7 rows in set (0.00 sec)
mysql> show grants for boy@localhost; 查看权限
+------------------------------------------------------------------------------------------------------------+