Page 1 of 1

MySQL Remote Connection

Posted: Sun Dec 25, 2005 10:06 am
by dwessell
Is it possible to connect to a remote databse?

Ie... Running a PHP script on my computer, and connect to the databse on the server from the script?

Thanks
David

Re: MySQL Remote Connection

Posted: Sun Dec 25, 2005 12:00 pm
by Chris Corbyn
dwessell wrote:Is it possible to connect to a remote databse?

Ie... Running a PHP script on my computer, and connect to the databse on the server from the script?

Thanks
David
Yes. You just put the first argument of mysql_connect() as the IP or qualified domain name of the remote server :) You'll need to make sure that the MySQL database on the remote server has permissions set for you to access it remotey....

Code: Select all

GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'IP/HOSTNAME' IDENTIFIED BY 'password'
Note: Using the search on this forum is damn useful.... this question has been asked many times before.

;)