Page 1 of 1
Linking to external database mysql
Posted: Thu Jun 20, 2002 6:18 am
by adrian27uk
I need to know how I can link to an external database mysql. Php scripts held on one server, and mysql database held on another. I was just interested in finding out if this was at all possible.
Many Thanks
Ade
Posted: Thu Jun 20, 2002 6:53 am
by volka
mysql_connect:resource mysql_connect ( [string server [, string username [, string password [, bool new_link]]]])
If connections are not blocked between the two servers it works
Posted: Thu Jun 20, 2002 10:29 am
by mikeq
You will need to create a user in mysql which is allowed to connect from a remote location. Lets say your PHP server IP is 192.168.1.1, your database on mysql is called mydb and the user name you want is myuser, from the mysql command line you can type this
mysql> grant all privileges on mydb.* to myuser@192.168.1.1 identified by 'mypassword';
mysql> flush privileges;
This will create a user called myuser with the password mypassword that has rights to connect from 192.168.1.1