I want to connect to another server... not localhost

visionofdesign

New Member
I have been working with mysql for about a year now, and I have never needed, until today, to connect to a database on a seperate server than the one I am running my php scripts on. Can anybody tell me what I have to put into the host argument of mysql_connect() to connect to a different server?
 

wulaishiwo4

New Member
I think you will call their server host, dbusername, dbpassword, dbname.. Try on that.

Anther tip is that Just re-read and realized I should be clearer. In my.cnf (the mysql config file, probably in /etc) there's a variable, something like networking=no, or skip-networking; I forget the specifics. Anyway, that needs to be set to enable networking then you need to restart mysqld.
 

nafirici

New Member
Anther tip is that Just re-read and realized I should be clearer. In my.cnf (the mysql config file, probably in /etc) there's a variable, something like networking=no, or skip-networking; I forget the specifics. Anyway, that needs to be set to enable networking then you need to restart mysqld.

You are correct, if skip-networking is in the my.cnf file and it's not commented out, than you're not going to be able to connect to mysql from another box. When I set up a new mysql box, I always test first if I can connect from the command line on the box, then I test from another box before I start messing with connecting php. This helps be figure out if it's network/firewall issue before I start doubting my php connection string.
 
Last edited:
Top