授权
1、连接mysql服务器
格式:mysql -h 主机名 -u 用户名 -p密码 库名
root>mysql -h localhost -u root -p
2、创建用户并授权
格式:grant 允许操作 on 库名.表名 to 账号@来源 identified by ‘密码’;
# 示例
mysql>grant select,insert,delete,update on g21.* to malikuan@'%' identified by '123';
# 或者指定本机可以访问
mysql>grant select,insert,delete,update on g21.* to malikuan@localhost identified by '123';
3、授权后更新权限
mysql>flush privileges;