Home
Archives
About us...
Advertising
Contacts
Site Map
 

ruby in steel

 

INSTALL MYSQL FOR WINDOWS

Many web hosts are run on Linux. With the appropriate software installed, you can develop many compatible applications on a PC running Windows.

 

If you are developing web applications such as Blogs and Content Management Systems (CMS), it is useful to install the software on your PC for local development. Many of the most popular web applications are written in PHP and make use of the MySQL database. For local development, you will need PHP, MySQL and a server. Many web hosts - including those running Linux - will have PHP, MySQL and the Apache Server installed. Here we explain how to install MySQL on a Windows-based PC. Before doing this, you may want to follow our guide to installing the Apache Server. Optionally, you may also want to follow our guide to installing PHP.

The MySQL main site is at http://www.mysql.com/ and from here you can navigate to the download page for the current version which, at the time of writing, is version 4.1 whose download page is found at: http://dev.mysql.com/downloads/mysql/4.1.html

You will need to scroll some way down this page to locate the Windows installers. You can either download the complete MySQL package (about 37MB) or the Windows Essentials package (about 16.5MB). The complete package contains extra tools for database developers but these are not required for our purposes. For most people, therefore, the smaller Windows Essentials download file is the one to get.

You should click the ‘Pick A Mirror’ link alongside the Windows Essentials download option. You will then be shown a questionnaire which you can fill out if you wish. If you don’t wish to do so, just scroll down the page and pick a regional download site. Click a link and save the file (currently named mysql-essential-4.1.14-win32.msi) to any convenient directory on your disk.

Once the download has completed, run the program by selecting Open in the download dialog, if it is still visible, or by double-clicking the installation file via Windows Explorer.

The first page of the Setup Wizard will now appear. Click the Next button.


The Typical setup is fine if you want to install into the default directory. If you want to choose a specific directory, select Custom

You can either leave the Typical setup option selected if you are happy to install the software into the default directory C:\Program Files\MySQL\MySQL Server 4.1\. If you want to install to some other directory, however, select Custom. Then click Next.

If you are doing a Typical installation you will now be asked to confirm the default options. If you are doing a Custom installation you should highlight the top item, MySQL Server, and click the Change button. Now navigate to, or enter the name of, your chosen target directory. In my case, I have chosen: F:\windev\MySQL. This directory will now automatically be selected for the installation of any additional features and you don't need to select the Client Programs item. So click Next.


The Custom Setup (if you choose this) lets you pick an installation directory

When you see the screen stating ‘Ready To Install the Program’, verify that the destination folder is correct, then click the Install button.


Whether you are doing a Typical or a Custom installation, you will eventually arrive at this dialog.
Time to click Install

You will now be prompted to create a new MySQL account. This will let you receive news of changes and updates. However, it isn’t an essential part of the software installation and you can sign up at a later time if you wish. For the sake of simplicity, I’ll select the Skip Sign-up option and click Next.


You can sign up if you like but this is not relevant to the installation process

The Wizard Completed dialog now appears. Click the Finish button.


The Wizard Completed dialog is just the beginning....!

In fact, as you will discover, this isn’t the end of the installation after all…

A new screen pops up welcome you to the MySQL Server Instance Configuration Wizard. Click Next. Assuming that this is the first time you’ve installed MySQL on this machine, you can select Standard Configuration (if you are upgrading from an older version of MySQL you need to select Detailed Configuration – that is beyond the scope of our simple setup guide). Click Next.


Select the Standard Configuration and click Next

In the next dialog, leave the default options selected (i.e. Install As Windows Service; Service Name = ‘MySQL’ and Launch the MySQL Server automatically). Then click Next.


Make sure you select the options shown in this dialog

In the next screen, leave ‘Modify Security Settings’ checked and enter the same password into the first two text fields. You will need this password later so remember it or write it down in a secure location. If you may need to access MySQL from another computer you can check ‘Enable root access from remote machines’. Then click Next.


Choose any password - as long as you can remember it!

The next screen just gives you some information about the tasks that are about to be performed. Click the Execute button.


This screen tells you what the setup program is about to do. Press the 'Execute' button

When everything is installed this screen appears:

Click Finish.

And that’s it!

Just to test that everything’s working, you can open the MySQL command line client. You can do this from the MySQL group on the Windows start menu. A ‘DOS box’ will appear and you will be prompted to enter your password:

Once you’ve entered this, you will be welcomed to the MySQL monitor with a mysql> prompt. Enter \h for some help. Enter quit to exit.

If you plan to use MySQL with PHP, refer to our PHP installation guide.

Problems...?

Note that PHP 5 does not automatically support MySQL. To add MySQL support, do the following:
--- Make sure you have php.ini in your \Windows directory (as explained in our PHP installation guide)
--- Edit php.ini in Notepad. Make sure the following line is uncommented (or added). To uncomment, delete the semi-colon at the start of the line:
   extension=php_mysql.dll
--- Search for the extension_dir entry and add the path to your php extension (\ext) subdirectory, which should already exist. e.g.
   extension_dir = "G:\php5\ext"
--- Ensure that your PHP extension directory contains the two files, php_msyql.dll and php_mysqli.dll. These should be installed by default. In principle, your main PHP directory (in my case, that's G:\php5) should be on the system path and it should contain the two files, libmysql.dll and libmysqli.dll. In fact, as explained in our PHP installation guide, libmysqli.dll is not provided with some versions of PHP and you may need to download it separately. You should now be able to restart your server and everything should be fine and dandy. In practice, PHP may complain that it cannot find the 'specified module'...


DLL Hell! You know the file is there. You can see it's there. But PHP still can't find it.
After several hours of tearing out our hair we came up with a fix for this problem.
Let's just hope it works for you too...

We fixed this problem by copying libmysql.dll and libmysqli.dll to the \Windows\System32 directory. Then restart Apache...


To restart the Apache server, find its icon (the one with the green arrowhead) to the right of the Windows toolbar, left-click and pick Restart from the menu

See also, our Guide To WAMP - Windows-Apache-MySQL-PHP

 

October 2005

 


Home | Archives | Contacts

Copyright © 2006 Dark Neon Ltd. :: not to be reproduced without permission