当前位置:Gxlcms > mysql > MySQL管理之用户权限

MySQL管理之用户权限

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

MySQL用户管理mysql授权级别·全局级别·数据库级别(能否删除创建库·表级别·字段级别·储存过程、存储函数级别需要了解的三种权限类型·管理类·数据库访问类



|
+------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test1'@'%' IDENTIFIED BY PASSWORD'*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |
| GRANT CREATE ON `wpdb`.* TO'test1'@'%' |
| GRANT CREATE ON `abc`.* TO'test1'@'%' |
| GRANT SELECT, INSERT, CREATE ON `test1`.* TO'test1'@'%' |
| GRANT CREATE ON `mysql`.`wpdb` TO 'test1'@'%' |
+------------------------------------------------------------------------------------------------------+
5 rows in set (0.00 sec)


|
| GRANT CREATE ON `abc`.* TO'test1'@'%' |
| GRANT SELECT, INSERT, CREATE, ALTER ON `test1`.* TO'test1'@'%' |
| GRANT UPDATE (age) ON `test1`.`testtb` TO'test1'@'%' |
| GRANT CREATE ON `mysql`.`wpdb` TO'test1'@'%' |
+------------------------------------------------------------------------------------------------------+
6 rows in set (0.00 sec)



mysql> showgrants for test1@'%';
+------------------------------------------------------------------------------------------------------+
| Grants for test1@% |
+------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test1'@'%' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |
| GRANT CREATE ON `wpdb`.* TO'test1'@'%' |
| GRANT CREATE ON `abc`.* TO 'test1'@'%' |
| GRANT INSERT, CREATE, ALTER ON `test1`.* TO 'test1'@'%' |
| GRANT UPDATE (age) ON `test1`.`testtb` TO'test1'@'%' |
| GRANT CREATE ON `mysql`.`wpdb` TO'test1'@'%' |
+------------------------------------------------------------------------------------------------------+
6 rows in set (0.00 sec)

一般来讲select都是读权限,一般可以赋予,,其他权限则都为写权限需要慎重考虑授权




本文出自 “心情依旧” 博客,请务必保留此出处

人气教程排行