一、创建数据库
create database test(你的库名);
show databases;
二、创建用户
CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;
三、授权
1、授权test用户有testDB数据库的某一部分权限:
grant select,update on testDB.* to test@'%' identified by 'test123';
2、授权test用户有testDB数据库的所有操作权限:
grant all privileges on testDB.* to 'test'@'%' identified by 'test123';
3、授权test用户拥有所有数据库的某些权限:
grant select,delete,update,create,drop on *.* to 'test'@'%' identified by 'test123';
注:
删除用户:
delete from user where user in ('test');
或者
drop user test@localhost;