is not allowed to connect to this mysql server

授权法。

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

FLUSH PRIVILEGES;

如果是lnmp下安装

为了安全起见,lnmp环境是禁止远程连接的,他会删除iptables里面的3306端口的防火墙规则

iptables里面删除drop 3306端口

将所有iptables 以序号标记显示,执行:
iptables  -L -n --line-numbers
添加3306端口号到防火墙
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
service iptables save
service iptables restart
service mysql restart

posted @ 2022-07-18 15:56  lenton  阅读(18)  评论(0编辑  收藏  举报