How to install MySQL5 on Windows

This article explains how to install, configure and run mySQL 5.0.x under Microsoft Windows. Note! You might want to install Apache HTTP server first, and if you have an older version of MySQL (4.x.x) it’s a VERY good idea to uninstall this first (don’t forget to backup…).

1. Download the latest version of MySQL 5

Download and install the latest version of MySQL 5.0.x from http://dev.mysql.com/downloads/mysql/5.0.html. Just make sure you get a Windows 95/98/NT/2000/XP/2003 (x86) binary, Windows Essentials (x86) version (skip all the questions part and scroll down to the mirrors list).

My file was named: “mysql-essential-5.0.20-win32.msi

2. Install MySQL 5 Windows Essentials (x86)

Run the MSI file and use the following settings

  • Custom Setup (just because I like to install it at “C:\mysql” instead of having it in the “Program Files” directory)
  • Skip Sign-Up
  • make sure “Configure the mySQL Server now” is checked
  • Detailed Configuration
  • Developer Machine
  • Multifunctional Database
  • InnoDB Tablespace Settings” – leave everything default
  • Decision Support (DSS)/OLAP
  • make sure “Enable TCP/IP Networking” is checked and leave the port number at 3306 (at this point, if you have a firewall, it will usually try to access itself on the localhost)
  • Standard Character Set
  • check “Install As Windows Service
  • I recommend leaving “Include Bin Directory in Windows PATH” checked
  • enter your root password
  • then hit “execute” and it´ll install and set it up

3. Getting PHP5 to work with MySQL 5

Unfortunately PHP5 removed built-in support for MySQL. So you´ll need to copy some files by hand. open the folder you unzipped your PHP to. Copy the “libmysql.dll” file (should be located like “c:\php5\libmysql.dll“) into your Window´s System folder (usually “C:\Windows\System32\” although might be “c:\WinNT\System\” or something).

Then open up your “php.ini” in a text editor and search for “;extension=php_mysql.dll” and remove the “;” in front of that line.

Do the same for “;extension=php_mbstring.dll“. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.

Restart Apache and see if you get any errors. If it complains about “php_mysql.dll” either your extention directory isn´t correct or windows can´t find “php_mysql.dll“.

If you don´t want to move files outside your php5 directory, you may also add the php5 directory to the PATH on Windows. Please read the following article on how to do this.

4. Testing MySQL

Testing MySQL is not exactly easy. However, here are the common connection strings for PHP and CGI. I recommend downloading phpMyAdmin and using it to create and manage your databases, etc.

About Author

3 Comments on “How to install MySQL5 on Windows”

Comments are closed.