Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Weird issue.

I've got a CentOS 5 server running, and I can't get MySQL to allow remote connections and local connections. IP Tables is setup correctly to allow the one remote server I need to connect to MySQL to do so.

skip-networking is commented out, and I don't have a bind address.

share|improve this question
Can you open the socket? – Warner Jul 27 '10 at 14:07
Only locally. I should also mention that I did set permissions to the DB in questions to allow a remote user. – rkalajian Jul 27 '10 at 14:13
Sounds like it's your firewall rules, if you're bound to the routable interface as you say. Provide the output of iptables -L -n. – Warner Jul 27 '10 at 14:53

First off, run something like this to see what you have now:

 [root@cacti ~]# netstat -lnpt | grep `cat /var/run/mysqld/ `
 tcp        0      0      *                   LISTEN      2814/mysqld

If you don't see a line like that, check what command line options are being passed to your binary by running something like this

 [root@cacti ~]# ps auxfwww | grep mysql
 root     12754  0.0  0.0  61200   728 pts/1    S+   10:46   0:00  |                   \_ grep mysql
 root      2767  0.0  0.0  65976  1064 ?        S    Jul12   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/ --user=mysql
 mysql     2814  2.1  0.8 348652 16848 ?        Sl   Jul12 464:20  \_ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/ --skip-external-locking --socket=/var/lib/mysql/mysql.sock

And lastly, show us your networking options from my.cnf. By default mysql will bind to tcp 3306 on startup unless you tell it not to. If you see anything inside the [mysqld] section related to networking you could try starting with just commenting it out.

Also it might help to check the log. Its not very clear, but it will tell you if and when it binds to a port on startup like this

 [root@cacti ~]# grep port /var/log/mysqld.log
 Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
share|improve this answer
up vote 1 down vote accepted

OK! Thanks for the help, people. Looking over your comments made me go over everything with a fine-toothed comb. Turns out my rule in iptables wasn't in the correct spot. I reordered my rules and it worked

share|improve this answer

SE-Linux is disabled or well configured?

share|improve this answer
SE-Linux is disabled. – rkalajian Jul 27 '10 at 14:05
Run as root netstat -lntp | grep mysql. What do you see? – lg. Jul 27 '10 at 14:30

If it's not iptables or mysql privileges and the server is listening on a tcp socket (port 3306) with it's public IP-address or with then I guess all that's left is the tcpwrapper.
Check /var/log/auth.log (not sure if it's called that way on CentOS) and your /etc/hosts.allow/deny files.
If /etc/hosts.deny has ALL:ALL (which you should have) then add in /etc/hosts.allow:

mysqld: <remote IP-address>

share|improve this answer

Sounds like it's your firewall rules, if you're bound to the routable interface as you say. Provide the output of iptables -L -n.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.