mysql用户与权限

1、创建用户
create user '用户名'@‘Ip地址’ identified by '密码'; 汉字对应的地方需要自己填写,其中’Ip地址‘可以填localhost,也可以填%代表,从任意ip都可登陆
例:create user 'test'@‘%’ identified by '123456'; 

2、简单数据库操作
1)、create database 数据库名; //创建数据库  2)、show databases; //查看数据库  3)、drop database 数据库名; //删除数据库

3、授权
grant all on 数据库名.* to '用户名'@‘ip地址’;
例:grant all on testdatabase.* to 'test'@'%';

4、删除用户
drop user '用户名'@‘Ip地址’;
例:drop user 'test'@'%';

5、撤销权限
revoke all on 数据库名.* from '用户名'@'Ip地址';
例:revoke all on testdatabase.*  from 'test'@'%';

原文地址:https://www.cnblogs.com/liangshibo/p/12565242.html