mysql开启远程登录权限

grant all privileges on *.* to root @"%" identified by "root";

 

报错:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

解决方法:

SHOW VARIABLES LIKE 'validate_password%';

在这里插入图片描述
密码的长度是由validate_password_length决定的,但是可以通过以下命令修改

set global validate_password_length=4;

validate_password_policy决定密码的验证策略,默认等级为MEDIUM(中等),可通过以下命令修改为LOW(低)

set global validate_password_policy=0;

flush privileges;

 

可能还不能远程访问,原因是防火墙没有开启端口

查看防火墙状态

firewall-cmd --state

开启防火墙

systemctl start firewalld.service

重启防火墙

firewall-cmd --reload

需要查看开放端口

firewall-cmd --zone=public --list-ports

开启端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent

关闭端口对外开放

firewall-cmd --permanent --remove-port=${port}/tcp

停止防火墙

systemctl stop firewalld.service

 

posted @ 2020-08-15 12:51  程序员小艺  阅读(172)  评论(0编辑  收藏  举报