1.dml权限
mysql> grant select,delete,update,insert,create on netcentre.* to 'ln_sale'@'%' identified by 'password';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show grants for 'ln_sale'@'%';
+--------------------------------------------------------------------------------+
| Grants for ln_sale@% |
+--------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ln_sale'@'%' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON `netcentre`.* TO 'ln_sale'@'%' |
+--------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
2. 查看information_schema权限
mysql> GRANT PROCESS, SUPER ON *.* TO 'infomn'@'%' IDENTIFIED BY 'infomn';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show grants for 'infomn'@'%';
+---------------------------------------------+
| Grants for infomn@% |
+---------------------------------------------+
| GRANT PROCESS, SUPER ON *.* TO 'infomn'@'%' |
+---------------------------------------------+
1 row in set (0.00 sec)
3.dml,函数,存储过程权限
mysql> grant alter routine,Create routine,execute,select,delete,update,insert,create on netcentre.* to 'ln_common'@'%' identified by 'password';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show grants for 'ln_common'@'%';
+---------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ln_common'@'%' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, EXECUTE, CREATE ROUTINE, ALTER ROUTINE ON `netcentre`.* TO 'ln_common'@'%' |
+---------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
4.普通dba权限
mysql> grant all privileges on *.* to 'test'@'%' identified by 'test';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> select * from mysql.user where user='test'\G;
*************************** 1. row ***************************
Host: %
User: test
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: N
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
password_expired: N
password_last_changed: 2023-08-05 00:04:37
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)
5. dba权限
mysql> select * from mysql.user where user='root' and host='localhost'\G;
*************************** 1. row ***************************
Host: localhost
User: root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
password_expired: N
password_last_changed: 2023-06-07 01:40:36
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)
ERROR:
No query specified
6.回收权限
mysql> revoke all on *.* from 'test'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for 'test'@'%'\G;
*************************** 1. row ***************************
Grants for test@%: GRANT USAGE ON *.* TO 'test'@'%'
1 row in set (0.00 sec)
ERROR:
No query specified
mysql> select * from mysql.user where user='test' and host='%'\G;
*************************** 1. row ***************************
Host: %
User: test
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
password_expired: N
password_last_changed: 2023-08-05 00:04:37
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)