First, the additions and deletions to new users
1. Add a new user
Allow local IP access to the localhost Mysql database:
mysql> create user 'common'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.07 sec)
Allowing access to the external network IP database editest, this command contains the above order, all the database can access the IP
mysql> create user 'common'@'%' identified by '123456';
Query OK, 0 rows affected (0.06 sec)
After the user is created, refresh the authorization
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
2. Delete user
drop user "用户名"@"IP地址";
3. Modify the user
rename user "用户名"@"ip地址" to "新用户名"@"IP地址";
4. Change Password
set password for "用户名"@"ip地址" = password("新密码");
Second, the user authorization
1. Check the permissions
show grants for "用户名"@"ip地址";
2. Authorizes all permissions for a user, in addition to grant this order, grant only root can use the command
grant all privileges on db1.b1 to "用户名"@"%"; 某一个用户可以对db1下的b1表进行任何操作.
grant all privileges on db1.* to "用户名"@"%"; 某一个用户可以在任何ip下对db1数据库进行任何操作
grant all privileges on *.* to "用户名"@"%"; 某一个用户可以在任何ip下对任何数据库进行任何操作
3. deauthorize
revoke all on *.* from "用户名"@"%" 取消某一个用户的全部权限
revoke all on db1.b1 from "用户名"@"%" 取消某一个用户对db1下的b1表的所有授权
revoke select on db1.b1 from "用户名"@"%" 取消某一个用户对db1下的b1表的查询授权