Jump to content
Larry Ullman's Book Forums

Installing Mysql On Seperate Server


Recommended Posts

Not sure if this is a topic for these forums.....Here goes...I am on chapter 9-PHP MySql for Dynamic Web Sites...Great book!

 

 

...My web pages are hosted on windows 2003 server(yes old but still runs fine)....Currently not using MySql on this......For book exercise purposes, MySql is installed on my desktop-I am using XAMPP and DOS prompt to access MySql. As I currently do not want to install MySql on the server just yet.... Is it possible to connect my web pages to the MySql database on my desktop for the purpose of performing the exercises in the book?  Any thought welcomed and thank you......

 

Link to comment
Share on other sites

Thanks for the nice words. Is your Windows server hosted elsewhere (not on the same network as your desktop)? And is your desktop literally in your home? And if it is in your home, is there a router?

 

The short answer is that it's definitely possible to connect to MySQL on another machine. But you might have problems based upon how easy, or hard, it is for the two machines to communicate.

Link to comment
Share on other sites

Thank you for the quick response......All machines in one location networked together..like this

 internet from street->my router->switch-> desktops and server(running windows 2003)(hosting websites running IIS 6 and also running Filemaker Server)....

 

I tried this:I opened a new port on router and used port forwarding and pointed to my desktop then on the web page "mysqli_connect.php" I tried to change the address to the url(as I have done with filemaker) and added the new port number.."DEFINE('DB_HOST', 'url:port#');"...........did not work....if i followed along in the book...is this correct..."DEFINE('DB_USER','root');....?"..I know you are busy so if you do not have time to respond ..no worries...,,.I am currently a member of the Boston PHP Percolate 6.....I am just trying to connect to use examples in the book(finished exerciese in ch 9)...no plans yet to use in production although I may try and use the technology in the future in real time

 

Many Thanks, David

Link to comment
Share on other sites

Okay, if they're all on the same network, that helps a lot. On the computer with MySQL, you'll need to create a new user that's allowed to connect from the IP address of the other machine (as opposed to localhost). Then, on the other machine, where PHP is running, you would connect to MySQL on the IP address of the machine that has MySQL running (as opposed to localhost). 

 

This also assumes there's no firewall in place. If so, you'll need to change that to allow for a MySQL connection through port 3306 (I believe).

Link to comment
Share on other sites

Thanks much for the quick response..Although I was not able to make  the above work ...you gave me an idea which did work....I used port forwarding on my router and used a different port for the new host machine(in XAMPP I changed the apache port to match the new port# in the router) and directed it to one machine running both MySql and XAMPP....

Many Thanks...... :)

Link to comment
Share on other sites

 Share

×
×
  • Create New...