Setting up a PHP Development Environment - Part 3: Installing MySQL
Welcome to the final installment of our 3 part series “Setting up a PHP Development Environment”. For those of you who haven’t installed Apache or PHP please checkout Part 1: Installing Apache and Part 2: Installing PHP4 tutorials on our site.
Setting up our Database Server…
For PHP we typically use the MySQL Database. MySQL is a open-source database built primarly for the LAMP stack (Linux, Apache, MySQL, PHP / Perl / Python.) but it’s very flexible, running on more than 20 platforms including Linux, Windows, OS/X, HP-UX, AIX and Netware (source: http://www.mysql.com). In the case of this tutorial we will be setting it to run on Windows XP.
Requirements:
- PHP 4 or later
Download the Windows Essentials (x86) binary from the MySQL website http://dev.mysql.com/downloads/mysql/4.1.html
The file I downloaded looked something like mysql-essential-4.1.20-win32.msi
2. Run the Widows Installer
After downloading the file run a quick virus scan and MD5 checksum to ensure the integrity of the download. Next double-click the msi file to run the Setup Wizard. Note: If you get the “Program Maintenance” screen come up this means you already have a version of MySQL on your system
Follow the following steps through the wizard;
1. Click next on the welcome screen

2. Select “Typical Installation” and click next

3. Choose your installation folder - mine is c:\MySQL (the same area as my Apache and PHP installations) - then click install.


4. Select “Skip Singup” on the MySQL.com sign-up screen (optional)

5. Now make sure “Configure the MySQL Server” is checked on the next screen and proceed - the MySQL Server Instance Configuration Wizard starts up

6. Click next on the welcome screen

7. Select “Standard Configuration” then next.

8. Select Install as Windows Service next - IMPORTANT: at this point if you have a firewall enabled you might get a prompt to block the service make sure you select “Unblock”.

9. Choose Modify Security Settings and choose a root password (remember this!) click next.

10. Take a deep breath and click execute on this screen.

11. MySQL is now setup and running as a service - you can check by right-clicking My Computer > Manage > Services
Note: PHP5 removed built-in support for MySQL so you need to some manual setup. Open the folder you unzipped your PHP to and copy the libmysql.dll file into the Window’s System folder then open up your php.ini in a text editor and search for ;extension=php_mysql.dll and remove the ; infont of that line.
3. Working with Firewalls
By default the MySQL Service runs off the 3306 port so if you have a Firewall, such as the Windows Firewall, at some point you should get a prompt, just make sure you select “Unblock” or whatever the equivalent is. You may have to create an exception for the MySQL service on the 3306 port in your firewall program. If your ever having trouble running MySQL check the service is running then make sure it’s not being blocked by the firewall.






Nice tutorial, like the screenshots!
Comment by Cameron Manderson — September 5, 2006 @ 12:56 pm
Thanks man. The screenshots do add some visual cues dont they
Comment by Richard Lee — September 5, 2006 @ 2:27 pm
Who’s using MySQL ?
del.icio.us, digg, Flikr, Wikipedia, Technorati, Yahoo, truila
craigslist, zimbra, feedster, feedburner, mixi.jp and many more…
Comment by Richard Lee — September 5, 2006 @ 2:29 pm