Forum Moderators: coopster

Message Too Old, No Replies

Connecting to remote mysql database

         

Crump

1:26 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



I am trying to connect to a remote database on another one of my servers. I can't seem to get it to make the connection. It gives me a timeout error.

The mysql port is open (I commented out the skip-networking option in the my.cnf file).

What else do I have to do to enable this user to access the db on the remote server? Do I have to change the users permissions?

Thanks!
CRUMP

FiRe

1:53 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



When I did this I had to give access to my IP on the server otherwise it just rejected me. Also remember the mysql host is not localhost...

Crump

3:34 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



What do you mean give access to the IP? I have changed the hostname.

Psychopsia

5:33 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



Hi Crump!
Are you using Cpanel?

If so, check this out: [cpanel.net...]

Crump

3:59 am on Oct 11, 2006 (gmt 0)

10+ Year Member



no, I am not using cPanel. Can anyone else offer any guidance?

Psychopsia

5:26 am on Oct 11, 2006 (gmt 0)

10+ Year Member



What kind of access do you have? Root Access?

I found this page: [linuxhelp.net...]

Hope this helps!

coopster

1:28 pm on Oct 11, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You need to GRANT [dev.mysql.com] the user access to the database on the remote server correctly first. Not just 'localhost' privileges, but either wildcard or specific host-name/ip-address specific. Details are in the GRANT syntax link there.

Next, you need to setup your connection to that host in your mysql_connect [php.net] command. Pay particularly close attention to the server argument given in Example 2.

Crump

3:29 pm on Oct 11, 2006 (gmt 0)

10+ Year Member



I think I have found the problem. I can't access the port from an outside computer. If I run nmap on the server, it says the mysql port is open (3306). If I run it on my local computer at home, there is no mention of the port.

What is interfering? I don't think I have a firewall installed on this server, although I might. How would I check that?

Thanks

Crump

5:07 pm on Oct 11, 2006 (gmt 0)

10+ Year Member



I forgot to mention, it looks like iptables is not running. What else can be causing this port to be blocked?