Forum Moderators: open

Message Too Old, No Replies

Use Remote mysql Database?

         

matthewamzn

8:12 pm on Jun 4, 2006 (gmt 0)

10+ Year Member



I'm trying to retrieve data from a remote mysql database, but I can't connect to it.

$conn = mysql_connect ("remoteserverip", db_username, db_password)
or die ('could not connect. ' . mysql_error());
mysql_select_db (db_name, $conn);

coopster

3:57 pm on Jun 5, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you certain the MySQL server is setup to allow remote connections?

matthewamzn

4:33 pm on Jun 5, 2006 (gmt 0)

10+ Year Member



I'm using the Plesk control panel. I do ssh into the server to create mysqldumps, but I haven't connected in this way before.

coopster

4:44 pm on Jun 5, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If you must use remote connections you should check into the security implications and permissions [dev.mysql.com] required to make remote connections. You may also want to have a closer look at the optional
MYSQL_CLIENT_SSL
client flag during mysql_connect() [php.net].

matthewamzn

5:10 pm on Jun 5, 2006 (gmt 0)

10+ Year Member



Do I need to login to the remote database (phpmyadmin) and enable connection from the originating server?

GRANT ALL PRIVILEGES ON db.* TO matt@'originserverip';