Installing MySQL Server on Windows
This page provides instructions for a Drupal developer who'd like to install MySQL 5 on their desktop computer. The instructions assume that you're running a recent version of Windows (NT, 2000, XP, or 2003). Older version like Windows 95, 98 and Me will not be addressed.
Download
The first step is to download the MySQL Server "Windows Essentials" binaries from the MySQL website at http://dev.mysql.com/downloads/mysql/. At the time this was written, 5.0.41 was the latest, stable release. The file was named: mysql-essential-5.0.41-win32.msi. Make sure you save the file to a location on your hard drive where you locate it.
Run the Installer
MySQL comes packaged as an .msi file that uses Microsoft's Installer to automate the installation process. Simply double-clicking on the file will begin the installation.
You'll be presented with several screens that guide you through the installation process:
- Welcome - Lets you verify the name and version of the program you're installing.
- Setup Type - Allows you to choose between a typical installation, a complete installation and a custom installation. Choose the "Typical installation".
- Ready to Install the Program - This is your final chance to confirm the installation. After clicking Install, you can sit back and watch the blue bar.
- MySQL.com Sign-Up - Allows you to sign up for an account with MySQL.com. This is completely optional, and in my opinion a waste of time. Select the "Skip Sign-up" option>.
- Competed - Informs you that everything has completed successfully and lets you launch the configuration wizard. Ensure that "Configure the MySQL Server now" option is checked before clicking "Finish".
Once the the installation wizard is completed, the configuration wizard begins.
- Welcome - Informs you that you're going to be configuring a MySQL server.
- Select Configuration Type - Gives you the choice between a Detailed and Standard Configuration. Select the "Standard Configuration" option.
- Set the Windows Options - Allows you to decide whether MySQL should run as a Windows Service and if the MySQL directory should be added to the system path. Make sure both options are checked.
- Set the Security Options - Lets you set a root (that's UNIX speak for administrator) password, enable remote root access and create an anonymous account. You are very strongly encouraged to set a root password. If you don't someone can connect to your server, start it, stop it, delete data and probably catch your computer on fire. Consider yourself warned.
- Execute - Gives you a final confirmation before the changes are saved.
Test the MySQL Installation
Open a command prompt and run the following command:
C:\>mysqladmin -u root -p versionYou'll be prompted for the root password that you entered during the configuration process. The resulting output should be similar to the following:
Enter password: *********
mysqladmin Ver 8.41 Distrib 5.0.41, for Win32 on ia32
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.41-community-nt
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306
Uptime: 1 min 34 sec
Threads: 2 Questions: 7 Slow queries: 0 Opens: 12 Flush tables: 1 Open tabl
es: 6 Queries per second avg: 0.074Create a database
Open the MySQL command line client using -u root to specify the root user and -p to be prompted for a password:
C:\> mysql -u root -pAfter entering your password, you should be greeted with a welcome message and prompt that looks something like:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.41-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>A quick note before we continue: the semicolon is used to indicate the end of a MySQL query or command. If you forget it MySQL assumes you're entering a multi-line query and you'll be prompted to begin the new line with a ->. This might take a little getting used to.
Now use the following command to create a database named drupal.
mysql> CREATE DATABASE drupal;If the command succeeds you'll get the following response:
Query OK, 1 row affected (0.00 sec)Add a user
Now, we'll add a new user account named drupaluser, with a password of supersecret to the drupal database we just created. The new user will allow us to log in and work on the database without having the full administrative permissions. That way if we make a mistake it'll only affect this database.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE
TEMPORARY TABLES, LOCK TABLES
ON drupal.*
TO 'drupaluser'@'localhost' IDENTIFIED BY 'supersecret';As mentioned before, when you enter a long command like this, the MySQL client may wrap the lines, beginning each with ->. For instance:
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE
-> TEMPORARY TABLES, LOCK TABLES
-> ON drupal.*
-> TO 'drupaluser'@'localhost' IDENTIFIED BY 'supersecret';Running that command produces the following output. It's worth nothing that even if the command succeeds, it will report that 0 rows were affected.
Query OK, 0 rows affected (0.02 sec)Once you've added the user, use the quit command to return to the command line.
Test Database and User
You can verify that both the database and user were created successfully with the following command:
C:\>mysql -u drupaluser -p drupalYou should then be greeted by the standard welcome screen. Run the following command to list the tables in the flickr database:
mysql> show tables;It's a new database so it should be empty:
Empty set (0.02 sec)Use the quit command to exit the MySQL client.
Other Tools
While you could do all your MySQL server administration from the command line, it is neither fun nor easy. MySQL offers several a free, easy-to-use graphical tools to simply the process. The MySQL Administrator provides a GUI for doing most database management. The MySQL Query Browser makes it easy to create and edit tables, run queries and insert, update and delete records. You can download the software from http://dev.mysql.com/downloads/gui-tools/5.0.html








Thank you!!!
I'm new to this and was trying to get this working. I finally got it up and running. Thanks.
Thanks!
I appreciate the quick walk through. I just installed the community version of MySQL and while I'm a 2 year veteran with SQL Server, I know absolutely nothing about MySQL. After installing the server, I found your site and with a few quick commands was able to verify that things seemed set up correctly. I look forward to installing the Admin and Query Browser features that you suggest...at this point I assume they're similar to EM and QE of SQL Server.
Thanks for posting this...it makes a difference!
Gabe Lawrence