I am not able to get a remote connection established to MySQL. From my pc I am able to telnet to 3306 on the existing server, but when I try the same with the new server it hangs for few minutes then returns
# mysql -utest3 -h [server ip] -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '[server ip]' (110)
Here is some output from the server.
# nmap -sT -O localhost -p 3306
...
PORT STATE SERVICE
3306/tcp closed mysql
...
# netstat -anp | grep mysql
tcp 0 0 [server ip]:3306 0.0.0.0:* LISTEN 6349/mysqld
unix 2 [ ACC ] STREAM LISTENING 12286 6349/mysqld /DATA/mysql/mysql.sock
# netstat -anp | grep 3306
tcp 0 0 [server ip]:3306 0.0.0.0:* LISTEN 6349/mysqld
unix 3 [ ] STREAM CONNECTED 3306 1411/audispd
# lsof -i TCP:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 6349 mysql 10u IPv4 12285 0t0 TCP [domain]:mysql (LISTEN)
I am running…
OS CentOS release 5.8 (Final)
mysql 5.5.28 (Remi)
Note: Internal connections to mysql work fine.
I have disabled IPtables, the box has no other firewall, it runs Apache on port 80 and ssh no problem.
Had followed this tutorial – http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
I have bound the IP address in my.cnf
user=mysql
bind-address = [sever ip]
port=3306
I even started over by deleting the mysql folder in my datastore and running
mysql_install_db --datadir=/DATA/mysql --force
Then recreated all the users as per the manual…
http://dev.mysql.com/doc/refman/5.5/en/adding-users.html
I have created one test user
CREATE USER 'test'@'%' IDENTIFIED BY '[password]';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
So all I can see is that the port is not really open. Where else might I look?
thanks
Best Answer
In the above command you are getting port close because your mysql is running on the specific IP and not on localhost. So, when you will run this command on the server, it will show the port is closed. So this makes sense. If you want that to work, you need to replace the bind-ip with value 0.0.0.0
So, Can you please replace localhost with server-ip and post the output here.
Also, I know you have disable the firewall but still but be great if you can help me with these couple of commands:
iptables -L -n
cat /etc/hosts.deny
Also, have you done any optimizations in mysql and changed any values for any variables. If yes, then please post the same also.