Installing MySQL is a very straightforward process. The following sections explain how to install MySQL on Windows and Linux.
Here are the basic steps to install MySQL on Windows:
Download the MySQL distribution from http://dev.mysql.com/downloads/mysql/5.1.html, picking up the
Windows Essentials
file from the Windows downloads section on the page. This file contains the minimum set of files needed to install MySQL, including the Configuration Wizard. If you want to download the package containing all the MySQL components, consider the Complete Package available on the same page and packed within a ZIP archive:mysql-5.1.xx-beta-win32.zip
.
Note
The above URL assumes that you download MySQL 5.1. At the time of this writing, though, MySQL 6.0 is available. You can download MySQL 6.0 from http://dev.mysql.com/downloads/mysql/6.0.html.
Execute the downloaded
mysql-essential-5.1.xx-beta-win32.msi
orSetup.exe
extracted frommysql-5.1.xx-beta-win32.zip
, in order to install MySQL.In the Setup Type page of the MySQL Installation Wizard, you have to choose Typical, Complete, or Custom. To be able to follow the book examples, you might choose the Typical installation type.
In the Confirmation dialog, click the Install button to start the installation.
After the installation is completed, on the final screen of the installer, make sure that the Configure the MySQL Server now checkbox is checked, and click Finish. As a result, the MySQL Configuration Wizard will be launched.
In the Configuration Type dialog of the Configuration Wizard, choose the Standard Configuration option if you want to get started with MySQL quickly.
Note
The following steps assume that you choose the Standard Configuration option in the preceding step.
In the next dialog, make sure that the Install As Windows Service option is selected.
In the next dialog, you have to set the root password.
In the final dialog on the MySQL Configuration Wizard, click the Execute button to start the configuration process.
Once you've completed these steps, you should have the MySQL server up and running on your machine.
Here are basic installation steps for MySQL on Linux:
Download the MySQL distribution from http://dev.mysql.com/downloads/mysql/5.1.html, picking up RPMs for
Server
andClient
from the appropriate section. These packages are required for a standard minimal installation.
Note
Using the RPM packages is the recommended way to install MySQL on Linux. The following steps assume that your Linux supports RPMs.
Perform the following commands to install the above RPMs:
# rpm -i MySQL-server-VERSION.i386.rpm # rpm -i MySQL-client-VERSION.i386.rpm
Note
By default, the server RPM creates and adds the entries to /etc/init.d/
, which are required to start the mysqld
server automatically at boot time.
After the installation, it is highly recommended that you assign a password to the anonimous accounts:
# mysql -u root mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('new_pswd'); mysql> SET PASSWORD FOR ''@'your_hostname' = PASSWORD('new_pswd');
Once you've completed these steps, you should have the MySQL server up and running on your machine.