Go Home

【持续更新】MySQL常用命令

新建用户

CREATE USER 'xxxx'@'localhost' IDENTIFIED BY 'xxxxx';

删除用户

DROP USER xxxx;
DROP USER 'xxxx'@'localhost';

用户赋权

GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

收回权限

REVOKE ALL PRIVILEGES ON *.* FROM 'user'@'%';
REVOKE GRANT OPTION ON *.* FROM 'user'@'%';

刷新权限

FLUSH PRIVILEGES;

克隆数据库

mysqldump --default-character-set utf8mb4 -u root -p lhen > lhen-release.sql
mysql -u 用户名 -p --database 数据库名 < D:abc.sql

07 Feb 2018