Hi guys, Currently I am doing a site for a client, my friend is a PHP/MySQL programmer and I am an ASP/MsSQL programmer. Th hosting we have does not support MySQL databases, but we have a huge system setup on MySQL DB, we also have a huge system on an MsSQL DB. The MsSQl I know that you can have on separate server under a separate hosting and then in connection line specify the IP of the server and connect to it. Is it possible to connect to a MySQL DB which is on a separate server that the site. The hosting company is the same. Could you please write the connection string for me. With regards,
Do you mean to connect to MySQL from command line? mysql -h hostname -P 3036 -u username -D database -p Code (markup): -h (=hostname) -P (=port) uppercase "P" -u (=username) -D (=database) -p (=password) lowercase "p" If you want to connect through PHP to the MySQL DB, you can use: $link = mysql_connect('hostname', 'mysql_user', 'mysql_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ("Can't use foo : " . mysql_error()); } PHP: This is from php.net, I'm not allowed yet to post URLs. Boby
Yes, you can do remote connections but only if the host allows it. So the server with the MySQL DB on it needs to allow remote connections. It's in the config of MySQL.