Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user

前端 未结 12 2234
北海茫月
北海茫月 2020-11-22 10:06

MySQL 5.1.31 running on Windows XP.

From the local MySQL server (192.168.233.142) I can connect as root as follows:

>mysql --host         


        
12条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 11:01

    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.

提交回复
热议问题