登陆命令:mysql -u root -p
添加本地用户:create user 'sheet'@'localhost' identified by '123456' ;
添加允许外网IP访问的用户:create user ‘sheet'@'%" identified by '123456';
刷新权限的命令是:flush privileges;
在添加用户时可能会报如下错误
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
应该是密码过于简单了
可以修改两个参数,降低一下要求
一,修改 validate_password_policy
set global validate_password_policy=0;
二,修改 vlidate_password_length
set global validate_password_length=1;
可用select命令查看
select @@validate_password_length;
给用户授权
2、授权:GRANT ALL PRIVILEGES ON *.* TO ‘username’@‘%’ IDENTIFIED BY 'password’;
刷新权限:FLUSH PRIVILEGES;
格式:grant 权限 on 数据库名.表名 to 用户@登录主机 identified by "用户密码";*.*代表所有权;