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
Linking to external database mysql
Moderator: General Moderators
-
adrian27uk
- Forum Newbie
- Posts: 2
- Joined: Thu Jun 20, 2002 6:18 am
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
If connections are not blocked between the two servers it works
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
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