I was left with the easy task of installing moodle.

I am VPNing to 2 servers, one for the database and the other apache/php

server 1 must connect over LAN to the mySQL db on server 2

  1. I added a user with following priveleges : +---------------+------------+ | host | user | +---------------+------------+ | % | mir | | 10.10.40.15 | mir | | x.x.x.x | mir |
    | localhost | mir |

  2. Disabled firewall temporary

  3. made sure that my username/password combinations are correct, flushed priveleges, restarted mysqld

  4. i wnt to /etc/my.cnf .. if i try to add the port=3306 bind-address=10.10.40.15 or anything that is different from 0.0.0.0 or 127.0.0.1 - mysql wouldn't restart

  5. i read and tried many forums and pages and asked friends for tips but nothing works

So my question to you :

  • are there any networking extensions that need to be installed for mysql, how do i know nothing is missing from the installation
  • any troubleshooting tips, any idea how to fix this, any step by step check list, am i missing something simple/stupid, please anything that comes to mind, let me know

Appreciate your feedback on this friday night stuck at work :P

link|improve this question

40% accept rate
feedback

5 Answers

up vote 2 down vote accepted

the problem was not from the mysql side, it was rather from the php/apache server all i had to do was "setsebool -P httpd_can_network_connect=1

obviously there was a problem getting connections go out of the server that should request.

it made me waste more time than i should .. so i thought i would leave a comment to document a possible fix

link|improve this answer
feedback
  1. Is it listetning on any port?

netstat -nap | grep -i mysql

  1. If it is - is there any visible traffic from your client side?

tcpdump -i [interface_name] -tnn host [client_ip] and port [mysql_port_number]

  1. If there is traffic... are there any responses send back??

tcpdump -i [interface_name] -tnn host [client_ip]

link|improve this answer
feedback

Pity you don't describe where exactly the connection broke or any error message. So here i try to put my general troubleshooting steps (apology if this is too n00b-minded):

  1. make sure your web server can ping db server - if necessary - make sure the firewall allowing this (icmp and 3306 later on)
  2. if 1 is ok, make sure web server can telnet to mysql's port in the db server.
  3. if 2 is ok, make sure you can login using any other username/password (open any from any host, or use root username for quick test)

Which of those 3 you stuck with - and we'll go deeper...

link|improve this answer
feedback

thanks guys for feedback, currently when i

mysql -u mir -h 10.10.40.15 -p Enter password: ERROR 2003 (HY000): Can't connect to MySQL server on '10.10.40.15' (111)

but when i

mysql -u mir -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.77 Source distribution

when i

telnet> open 10.10.40.13 3306 Trying 10.10.40.13... Connected to 10.10.40.13 (10.10.40.13). Escape character is '^]'. 4 5.0.77dAWsZLLz,Aq;m6cn$`=NOConnection closed by foreign host.

as for the netstat , here is output

netstat -nap | grep -i mysql tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 16698/mysqld
unix 2 [ ACC ] STREAM LISTENING 264736 16698/mysqld /var/lib/mysql/mysql.sock

for the tcp dump 1403 packets captured 1404 packets received by filter 0 packets dropped by kernel

i can ping the both addresses

any further ideas - really thanks for the feedback

link|improve this answer
feedback

Is SELinux enabled?

link|improve this answer
i donno much about SELinux, should i disable it ? what command u recommend ? i tried echo 0 > /selinux/enforce then [root@jimmy ~]# mysql -u mir -h 10.10.40.15 -p Enter password: ERROR 2003 (HY000): Can't connect to MySQL server on '10.10.40.15' (111) – mireille raad Apr 24 '10 at 3:17
feedback

Your Answer

 
or
required, but never shown

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