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 = 'http://mydomain.com/mysql';
$DBHOST = 'http://mydomain.com/localhost';
$DBHOST = 'http://mysql.mydomain.com';
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?
ehcpdeveloper
Wed, 01/06/2010 - 11:25
Permalink
lets say, your script in ip
lets say, your script in ip A, (for ex, 88.222.33.44)
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)
$dbhost='B'
then,
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 = 127.0.0.1
to
bind-address = 127.0.0.1, B (ipofyourserver)
then, restart mysql
/etc/init.d/mysql restart
keep in mind that, you need your port 3306 open toward your server.
Netlink
Thu, 01/07/2010 - 00:59
Permalink
Mysql
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?
ehcpdeveloper
Thu, 01/07/2010 - 10:47
Permalink
no, i dont think it is
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.