Mysql Remote Connect

Guys, I am trying to connect to my MYSQL DB from a remote server. From my local server this works fine for all my Domains

$DBTYPE = 'mysql';
$DBHOST = 'localhost';
$DBUSER = 'dbuser';
$DBPASSWORD = 'dbpassword';
$DBNAME = 'somedb';
// End Configuration

The remote script will be using same configuration info as above. It is just a bridge between one CMS script and another so when users sign up in one, they are automatically signed up in the other.

All is fine but need to kow how to connect to the DB since the two scripts are on two different servers.

This is what I ned to change
$DBHOST = 'localhost';

I have tried
$DBHOST = '';
$DBHOST = '';
$DBHOST = '';

Last one of course needs a DNS change to work
I guess I am now finding out there is more to this than just the URL.

How can I accomplish the above?


lets say, your script in ip A, (for ex,
and your mysql server is in ip B,
A wants to connect to B, (A->B)

use in your script,(or config.php in ehcp dir)

in your mysql server at B , go to phpmyadmin, login as root,
go to privileges (Yetkiler), add a new user,
while adding, set hostname as 'A', add new user. use same username and password as original.

this way, any script in A will be able to connect to server at B.

you may need following too:
in B, in console, open file /etc/mysql/my.cnf

replace line
bind-address =
bind-address =, B (ipofyourserver)

then, restart mysql
/etc/init.d/mysql restart

keep in mind that, you need your port 3306 open toward your server.

Thanks for your response.

Will try above when I get back to my server. I may run into some issues with port 3306.

I remember opening that port for my other Radio server. I run a Radio Station on that server and my broadcasting software needs that port open so I have it open on my router but directed to the other server.

Am I able to use a different port or will this complicate things too much?

no, i dont think it is complicated,

just you need to set it in mysql configs.
mysql is using 3306 by default, but you can change it with little effort, i think.