Mysql 创建用户 数据库 并授权

Scroll Down
创建数据库
create database dbname character set utf8mb4 collate utf8mb4_bin;
创建用户
CREATE USER username@'%' IDENTIFIED BY mypassword;
授权
grant all privileges on dbname.* to username@'%' identified by mypassword;
管理员权限授权
grant all privileges on *.* to dbname@'%' identified by mypassword;
设置其它用户的权限
GRANT privileges ON databasename.tablename TO username@'%' WITH GRANT OPTION;
刷新权限
flush privileges;