MYSQL 常用命令
No date
1, 安装
brew install mysql
2, 启动
% mysql.server start Starting MySQL .. SUCCESS! %
3, 关闭
% mysql.server stop Shutting down MySQL . SUCCESS! %
4, 连接
mysqlsh
\c localhost
\sql
5, 查询用户
SELECT USER, Host FROM mysql.user
6,增加用户并授予所有权限
CREATEUSER'newuser'@'localhost' IDENTIFIED BY'password';
GRANTALL PRIVILEGES ON*.*TO'newuser'@'localhost'WITHGRANT OPTION;
FLUSH PRIVILEGES;
7,删除用户
DROP USER 'username'@'host';