MySQL权限,mysql权限管理,mysql添加新用户,mysql分配权限,mysql grant,mysql revoke

  1. 云栖社区>
  2. 博客>
  3. 正文

MySQL权限,mysql权限管理,mysql添加新用户,mysql分配权限,mysql grant,mysql revoke

优惠券活动 2018-11-29 13:27:01 浏览1264
展开阅读全文

MySQL权限,mysql权限管理,mysql添加新用户,mysql分配权限,mysql grant,mysql revoke

MySQL添加新用户,为新用户分配权限,Mysql版本5.7

首先进入Mysql控制台:

mysql -uroot -p
grant授权格式:grant 权限列表 on 库.表 to 用户名@'ip' identified by "密码";

创建一个新用户(user)并为此用户分配权限(这里先分配对所有数据库的表增删改查的权限),identified by 后面填入你新用户的密码

grant select,insert,update,delete on *.* to 'user'@'%' identified by 'your password';
如果是给予全部权限那么就这样

grant all privileges on *.* to 'user'@'%' identified by 'your password';
记得每次操作完要刷新授权

flush privileges;
查看用户权限

 show grants for user;
回收权限,revoke回收权限格式:revoke 权限列表 on 库.表 from 用户名@'ip';

revoke select,insert,update,delete ON *.* from 'user'@'%'
 

 

操作权限列表 参考MySQL官网说明 Privileges Provided by MySQL

Table 6.2 Permissible Privileges for GRANT and REVOKE

Privilege Column Context
ALL [PRIVILEGES] Synonym for “all privileges” Server administration
ALTER Alter_priv Tables
ALTER ROUTINE Alter_routine_priv Stored routines
CREATE Create_priv Databases, tables, or indexes
CREATE ROUTINE Create_routine_priv Stored routines
CREATE TABLESPACE Create_tablespace_priv Server administration
CREATE TEMPORARY TABLES Create_tmp_table_priv Tables
CREATE USER Create_user_priv Server administration
CREATE VIEW Create_view_priv Views
DELETE Delete_priv Tables
DROP Drop_priv Databases, tables, or views
EVENT Event_priv Databases
EXECUTE Execute_priv Stored routines
FILE File_priv File access on server host
GRANT OPTION Grant_priv Databases, tables, or stored routines
INDEX Index_priv Tables
INSERT Insert_priv Tables or columns
LOCK TABLES Lock_tables_priv Databases
PROCESS Process_priv Server administration
PROXY See proxies_priv table Server administration
REFERENCES References_priv Databases or tables
RELOAD Reload_priv Server administration
REPLICATION CLIENT Repl_client_priv Server administration
REPLICATION SLAVE Repl_slave_priv Server administration
SELECT Select_priv Tables or columns
SHOW DATABASES Show_db_priv Server administration
SHOW VIEW Show_view_priv Views
SHUTDOWN Shutdown_priv Server administration
SUPER Super_priv Server administration
TRIGGER Trigger_priv Tables
UPDATE Update_priv Tables or columns
USAGE Synonym for “no privileges” Server administration
 
--------------------- 
作者:dongsir007 
来源:CSDN 
版权声明:本文为博主原创文章,转载请附上博文链接!

网友评论

作者关闭了评论
优惠券活动
+ 关注