MySQL 基础管理

#用户管理

  - 白名单设定

用户名@'白名单'
白名单支持的方式?
wordpress@'10.0.0.%'    
wordpress@'%'
wordpress@'10.0.0.200'
wordpress@'localhost'
wordpress@'db02'
wordpress@'10.0.0.5%'
wordpress@'10.0.0.0/255.255.254.0'

  - 创建用户

增:
mysql> create user zyc@'43.82.209.%' identified by '123';
查:
mysql> desc mysql.user;
mysql> select user ,host ,authentication_string from mysql.user
改:
mysql> alter user zyc@'43.82.209.%' identified by '456';
删:
mysql> drop user zyc@'43.82.209.%';

  - 授权

ALL:
  SELECT,INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, 
  PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER,
  CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE,
  REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE,
  ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ALL : 以上所有权限,一般是普通管理员拥有的 with grant option:超级管理员才具备的,给别的用户授权的功能
1 mysql> grant all on wordpress.* to wordpress@'43.82.209.%' identified  by '123';
    #grant:授权命令
    #all:权限
    #on: 作用命令
    #wordpress.*:权限的作用范围
      ##
        *.* --->全库.全表 管理员用户
        wordpress.* --->wordpress库 应用开发用户
        wordpress.t1
      ##
    #to: 作用命令

2 mysql> grant select ,update,insert,delete on app.* to app@'43.80.209.%' identified by '123';

    - 查看授权

1 mysql> show grants for zyc@'43.82.209.%';

   - 回收授权

1 mysql> revoke delete on app.* from zyc@'43.82.209.%';

猜你喜欢

转载自www.cnblogs.com/crossworld/p/11519562.html