The MySQL installation process on Windows uses a standard Microsoft Windows Installer (MSI) file to walk you through the installation and configuration of MySQL on your Windows 2000, Windows XP, or Windows Server2003 machine. Go to the MySQL downloads page at http://dev.mysql.com/downloads/mysql/5.0.html and look for the section titled "Windows downloads." Download the Windows Essentials file, which should have a *. msi file extension. When this file has been downloaded, double-click the file to begin the installation process.
The following steps detail the installation of MySQL 5.0.20 on Windows using the Windows Essentials installer from MySQL AB. The install sequence will follow the same steps regardless of your Windows environment.
By the Way
Two other installation packages are available for Windows usersthe Complete Package and Noinstall Archive. If you want to install either of these versions instead of the Windows Essentials version described here, be sure to read the descriptions and instructions in the MySQL Manual at http://dev.mysql.com/doc/refman/5.0/en/windows-choosing-package.html.
Jumping right into the installation sequence (assuming you have downloaded the Windows Essentials installer from the MySQL AB website), follow these steps:
Double-click the *.msi file to begin the installation sequence. You will see the first screen of the installation wizard, as shown in Figure 2.4. Click Next to continue.
Figure 2.4. The firststep of the MySQL Setup Wizard for Windows.
Select the installation methodTypical, Complete, or Custom (see Figure 2.5). The Custom option allows you to pick and choose elements of MySQL to install, where as the Complete option installs all the components of MySQL, which range from documentation to bench marking suites. The Typical installation method is suitable for most users because it includes the client, server, and numerous tools for general management of your MySQL installation. Select Typical as the installation method and click Next to continue.
Figure 2.5. Select an installation type.
Confirm your choice in the next screen and click the Install button to continue. The installation process will take over and install files intheir proper locations.
By the Way
During the installation process, you may be asked to log in or create a MySQL.com user account. This account has nothing to do with your database installation; rather it is for registering with the MySQL.com website. If you already have an account, enter your username and password when prompted to do so. If you do not have a MySQL.com account, you will be prompted to create one. You also have the option of skipping the registration process altogether.
When the installation is complete, you have the option of continuing to the MySQL Configuration Wizard. This wizard is highly recommended because it will create a custom my.ini file, tailored to your particular needs. To continue on to the MySQL Configuration Wizard, check the Configure the MySQL Server Now check box and click the Finish button, as shown in Figure 2.6.
Figure 2.6. MySQL has been installed, now continue to the Configuration Wizard.
When you see the Configuration Wizard welcome screen, click the Next button to go to the next step in the wizard. You will see two options for server configuration: Detailed and Standard. We will use the Detailed Configuration option so you can see all the options availableto you. If you decide to select the Standard Configuration option, you will have to manually modify the resulting my.ini file to achieve the configuration you want. Select the Detailed Configuration radio button and then click Next to continue.
The next selection you must make is shown in Figure 2.7. In this step, you select the type of machine you are running: Developer Machine, Server Machine, or Dedicated MySQL Server Machine. Your selection on this screen determines the allotments for memory, disk, and processor usage. If you are using MySQL on your personal machine for testing purposes, select the Developer Machine option. If MySQL is running on a machine with other server software and can take up more system resources than if you were running it on your personal machine, select the Server Machine option. Select the Dedicated MySQL Server Machine option if MySQL is the primary service running on the machine andcan take up the bulk of the system resources. After making your selection, click Next to continue.
Figure 2.7. Select your server type as part of the MySQL configuration.
The next configuration option pertains to database usage. The options are Multifunctional Database, for both InnoDB and MyISAM storage engines with resources split evenly between the two; Transactional Database, which also enables both InnoDB and MyISAM but dedicates the most server resources to InnoDB; and Non-Transactional Database Only, which disables InnoDB and applies all resources to MyISAM. Unless you know exactly what your database will be used for, select the Multifunctional Database radio button and click Next to continue.
If you have selected a database usage option that includes the InnoDB storage engine, the next step in the configuration process allows you to configure the disk location and storage thresholds. The defaults are shown in Figure 2.8, which you can simply confirm by clicking Next to continue, or you may change these settings and then click Next to continue with your custom settings in place.
Figure 2.8. Tune the disk usage options for the InnoDB storage engine.
The next configuration option determines the number of concurrent connections to your MySQL server. Your setting will depend on the amount of traffic and database usage by your website or application. The default setting is Decision Support (DSS)/OLAP, which has a maximum number of 100 concurrent connections with an average of 20 assumed. The Online Transaction Processing (OLTP) option has a maximum of 500 concurrent connections, and the Manual setting allows you to select a number from a drop-down list or enter your own. Make your selection and click Next to continue.
The Networking Options screen is next in the configuration sequence. Here you will enable or disable TCP/IP networking as well as configure the port number used to connect to MySQLthe default is 3306, but you can use any unused port you choose. The other option on this screen is to enable or disable strict mode; enabling strict mode is recommended unless you know what you're changing. See http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html for more information. Make your selections and click Next to continue.
By the Way
Remember to modify your firewall rules to allow traffic to flow on port 3306 (or whichever port you decide to use for MySQL).
After the Networking Options screen comes the Character Set options. The default option is Standard Character Set, which results in Latin1 being used through out your database. You can also select the Best Support for Multilingualism option, which will result in UTF8 as the character set; UTF8 allows you to store multiple languages in a single character set. If you want to use a specific character set, select the Manual Selected Default Character Set radio button and then select the appropriate character set from the drop-down list. After making your selection, click Next to continue.
It is recommended that MySQL be installed as a service, and the configuration screen shown in Figure 2.9 shows how this is done. Check the Install as Windows Service check box and select a name for the service. Optionally, check the Launch the MySQL Server Automatically check box. You also have the option of adding the MySQL bin directory to your Windows PATH, for easier invocation of MySQL from the cmd prompt; check the box if this is appropriate for you. When you have completed your selections, click Next to continue.
Figure 2.9. Continuing the MySQL server instance configuration.
The Security Options configuration screen is the most important of them all. As shown in Figure 2.10, use this configuration screen to set a root password. Enter the password twice to confirm it. Do not check the Enable Root Access From Remote Machines check box unless you really know what you're doing; typically, root connections are only allowed from localhost. Additionally, you can create an anonymous account, but this is not recommended for security reasons. After completing the configuration options in this screen, click Next to continue.
Figure 2.10. Creating a password for root during MySQL configuration.
One more step remains in the configuration sequence, and that is to click the Execute button to start the process. After the wizard has made it through the various configuration steps, you will see a confirmation screen as shown in Figure 2.11, indicating the configuration file has been created and the MySQL service started. Click Finish to close the wizard.
Figure 2.11. The MySQL Configuration Wizard completes its tasks.
The completion of the installation and configuration wizards results in a running MySQL service and a custom my.ini file in the C:\Program Files\MySQL\MySQL Server 5.0\ directory.
Did you Know?
You can manually edit the my.ini file with any text editor; after making changes, you must restart your MySQL server.
Now that MySQL has been started, skip down to the "Basic Security Guidelines" section. If you had any issues with your installation, check the "Troubleshooting Your Installation" section.