| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: May 2005 Location: Ontario Canada
Posts: 3,088
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Connecting to a database on another host Hey I want to code php and run it on my desktop [i have everything installed and working] but i want to use the db that is on my site..so that i dont have to backup and import the db everytime i am done for the day... Is there any way of connecting to my sites db through php which is not on that same domain/site at the moment? thanks
__________________ |
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 360
![]() ![]() ![]() ![]() | sure can. taken from http://www.php.net/mysql_connect change example.com to your website and 3307 to your mysql port number. Also make sure you've enabled mysql to accept connection from other domains. Which in phpmyadmin is in Privledges for your user change it to your home ip or % for a wildcard, which isn't really a great idea todo. this is also a fairly older tutorial but seems to have the information you need. http://webmaster.iu.edu/tool_guide_i...sertable.shtml PHP Code:
__________________ Canadian Domain Registrar Ready.ca |
| |
| | #4 (permalink) |
| New Member Join Date: Dec 2006 Location: Atlanta, GA
Posts: 14
![]() | If you are connecting to a database over the internet, it is a good idea to consider using SSH port forwarding to allow for strong authentication and encryption of the data in transit. Frank
__________________ Software Developer, www.peachtreecommunication.net. Director of Membership, Metro Atlanta ISSA. Author of SQL Converter for Excel, which is an Excel add-in for converting data to MySQL. |
| |
| | #5 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 360
![]() ![]() ![]() ![]() | Hey Frank, I have never thought of doing that before, Is there much in the way of decrease in performance/speed? Do you have any tutorials on the concept and setup? Cheers, Baxter
__________________ Canadian Domain Registrar Ready.ca |
| |
| | #6 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 390
![]() ![]() ![]() | Great Question And Response (Bookmarked and Rep+)
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | #7 (permalink) | ||||
| New Member Join Date: Dec 2006 Location: Atlanta, GA
Posts: 14
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=278842 I do not know of a tutorial, but the setup is straight forward. You configure your SSH client to listen on a particular port on your localhost and pipe that to a particular port at the remote side. For example, if I do not have a MySQL server on my local machine I could port forward 3306 to example.com:3306. 3306 could even be fire-walled on the remote side and as long as SSH is allowed through the connection can work. The destination does not even have to be on the same machine as the SSH server. It makes for a very flexible VPN solution. Frank
__________________ Software Developer, www.peachtreecommunication.net. Director of Membership, Metro Atlanta ISSA. Author of SQL Converter for Excel, which is an Excel add-in for converting data to MySQL. | ||||
| |