创建用户
create user 'test'@'localhost' identified by '123456'; create user 'test'@'192.168.1.2' identified by '123456'; create user 'test'@'%' identified by '123456';
/*授予用户通过外网IP对于该数据库的全部权限*/ grant all privileges on `test`.* to 'test'@'%' ; /*授予用户在本地服务器对该数据库的全部权限*/ grant all privileges on `test`.* to 'test'@'localhost'; grant select on test.* to 'user1'@'localhost'; /*给予查询权限*/ grant insert on test.* to 'user1'@'localhost'; /*添加插入权限*/ grant delete on test.* to 'user1'@'localhost'; /*添加删除权限*/ grant update on test.* to 'user1'@'localhost'; /*添加权限*/ flush privileges; /*刷新权限*/