MySQL Remote Connection

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

MySQL Remote Connection

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: MySQL Remote Connection

Post 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.

;)
Post Reply