远程连接mysql数据库失败:
Can’tconnecttoMySQLserveron‘ro。。。
##远程连接mysql数据库失败:Can’t connect to MySQL server on ‘root'(10038)的解决办法
下⾯是⼀些解决⽅案在我使⽤的最新LNMP环境包的时候遇到的情况是防⽕墙iptables 阻⽌了外⽹IP访问3306
我的解决⽅案是清除iptables规则解放3306
清除已有iptables规则
mysql无法连接到服务器iptables -F
linux命令查看磁盘使用情况iptables -X
(我本⼈执⾏到这⼀步就可以了)
1、设置⽤户权限
修改⽤户远程登录权限:
python3下载免费版⽐如想给⽤户root(密码:123456)设置从任何主机连接到mysql服务器:
连接linux,登录数据库:
# mysql -uroot -p
# Enter password:******
MySQL [(none)]> use use mysql;
MySQL [(mysql)]> GRANT ALL PRIVILEGES ON *.* TO ’root‘@'%' IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
MySQL [(mysql)]> flush privileges;
MySQL [(mysql)]> quit;
报这个错误的话 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by "123456"' at line 1
⽤下⾯这句
create user root@'%' identified by '123456';
grant all privileges on *.* to root@'%' with grant option;
重启MySQL:
# service mysqld restart
常量的化学反应是什么2、检查防⽕墙有没有屏蔽掉3306端⼝。
Centos系统的话,编辑 /etc/sysconfig/iptables:
# vim /etc/sysconfig/iptables
加⼊⼀⾏:
syntax error是什么意思
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
重启iptables:
borderlands 2 wiki
# service iptables restart

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。