1、创建数据库

CREATE DATABASE dbname;

2、创建用户

CREATE USER 'UserName'@'%' IDENTIFIED BY 'Password';

3、设置访问指定数据库权限

GRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE, ALTER ROUTINE, CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, EVENT ON `dbname`.* TO 'UserName'@'%';
GRANT GRANT OPTION ON `dbname`.* TO 'UserName'@'%';

 

Logo

更多推荐