MySQL新建用户

MySQL新建用户和同名数据库并赋予所有权限

SQL语句:


CREATE USER 'mogu'@'localhost' IDENTIFIED BY  '123456';
GRANT USAGE ON * . * TO  'mogu'@'localhost' IDENTIFIED BY  '123456' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
CREATE DATABASE IF NOT EXISTS  `mogu` ;
GRANT ALL PRIVILEGES ON  `mogu` . * TO  'mogu'@'localhost';

MySQL 创建 root 用户


CREATE USER 'root'@'192.168.1.10' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.10' IDENTIFIED BY '123456';

发表评论