创建用户:
create user 'test'@'localhost' identified by 'michael123';
test: 用户名
michael123: 密码
localhost: 只有本机可以访问
create user 'michael'@'%' identified by 'michael123';
%:任何电脑都可以访问
create user 'winter'@'9.110.238.211' identified by 'winter123';
9.110.238.211:winter只能从这个ip登录
密码为空:winter01不需要密码登陆服务器。
创建、删除、切换数据库
create database mysql01;
drop database mysql01;
use mysql01;
授权:
GRANT ALL ON mysql01.* TO 'michael'@'%'
ALL: 所以权限,也可以单独制定delete, select, update, insert
mysql01: 在这个数据库上的权限
michael:用户
%:任何有michael的电脑上
grant all privileges on mysql01.* to