Mysql 创建用户

语法:

CREATE USER 'username'@'host' identified by 'password';

例子:

CREATE USER 'test'@'localhost' identified by 'test123';

用户权限授予

语法:

GRANT 权限1,权限2,....权限n ON dbname.* TO 'username'@'host' identified by 'password';

例子:

1.GRANT SELECT,UPDATE ON test.* to 'test'@'%' identified by 'test123'; //授予部分权限
2.GRANT ALL PRIVILEGES ON test.* to 'test'@'%' identified by 'test123'; //授予全部权限

刷新权限

FLUSH PRIVILEGES `