September 5, 2006

Setting up a PHP Development Environment - Part 3: Installing MySQL

You will find other articles relevant to this document in these sections:
Richard Lee @ 11:18 am

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


1. Download MySQL 4.1

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

Welcome Screen
2. Select “Typical Installation” and click next

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

Install MySQL Screen

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

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

Start Config Screen
6. Click next on the welcome screen

Config Welcome Screen
7. Select “Standard Configuration” then next.

Select Config Screen
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”.

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

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

Execute Config 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.

    Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    • del.icio.us
    • digg
    • Furl
    • Reddit
    • YahooMyWeb

3 Comments »

  1. Nice tutorial, like the screenshots!

    Comment by Cameron Manderson — September 5, 2006 @ 12:56 pm

  2. Thanks man. The screenshots do add some visual cues dont they ;)

    Comment by Richard Lee — September 5, 2006 @ 2:27 pm

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

RSS feed for comments on this post. TrackBack URI

Leave a comment