MySQL: How to allow remote connection to mysql

后端 未结 16 1180
北海茫月
北海茫月 2020-11-21 06:15

I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source.

How can I do that

16条回答
  •  被撕碎了的回忆
    2020-11-21 06:50

    In my case I was trying to connect to a remote mysql server on cent OS. After going through a lot of solutions (granting all privileges, removing ip bindings,enabling networking) problem was still not getting solved.

    As it turned out, while looking into various solutions,I came across iptables, which made me realize mysql port 3306 was not accepting connections.

    Here is a small note on how I checked and resolved this issue.

    • Checking if port is accepting connections:
    telnet (mysql server ip) [portNo]
    • Adding ip table rule to allow connections on the port:
    iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
    • Would not recommend this for production environment, but if your iptables are not configured properly, adding the rules might not still solve the issue. In that case following should be done:
    service iptables stop

    Hope this helps.

提交回复
热议问题