Installing MySQL Server

Caution:

Do not install MySQL 4.1.xx or higher if you want to host Azndragon's ROCP. Although there are ways to work around potential problems, it is better to avoid those all together.

Download

Download MySQL 4.0.xx installer from www.mysql.com, unpack if needed into a directory in your download folder.

Installation

Double click on the installer, choose default setting when prompted and there you go, an SQL server on Windows.

my-01: Starting the installation
Double click on the installer to start


my-02: Installation notes
Read the installation notes if you please


my-03: Installation directory
Default installation directory is C:\mysql
If you are installing MySQL 4.1, change the installation directory to C:\mysql.


my-04: Last chance to abort
Select Typical
Click Next to begin installation


Starting MySQL

win-my-admin: Winmysqladmin
Navigate to C:\mysql\bin, look for winmysqladmin.exe and double click it. When a dialogue box prompts you for user name and password, key in the username as root and leave the password blank, click OK.

We are using winmysqladmin.exe to install and start MySQL as a Windows service. When it is done, remove winmysqladmin shortcut from the startup folder.

xpcp-serv-mysql: Windows services -- MySQL
Successfully installed MySQL service:


DOS Commands

As you would expect, MySQL service can be installed and started from DOS. This will be the only way when winmysqladmin.exe fails to do the job.

Installing and starting MySQL service from DOS:
> bin\mysqld-nt --install mysql --defaults-file=%windir%\my.ini
> net start MySQL

Alternative start and stop commands:
> mysql\bin\mysqld --defaults-file=%windir%\my.ini --standalone
> mysql\bin\mysqladmin shutdown

Uninstalling MySQL service from DOS:
> net stop mysql
> bin\mysqld-nt --remove mysql
> del %windir%\my.ini

MySQL configuration file:

my-ini: MySQL configuration file
There are two configuration files:
my.ini: installed in Windows root (C:\Windows) by packages downloaded from MySQL.com. This is more or less considered the default configiuration on Windows.

my.cnf: installed in Windows partition root (C:\) by all-in-one packages like XAMPP from Apachefriends.org. This appears as a Windows shortcut.
Caution: do not edit my.ini or my.cnf unless you know what you are doing.


MySQL directories:

win-my-data: MySQL data directory
C:\mysql\bin: MySQL executables are found here. You will need those executables to issue command line instructions such as those mentioned earlier.

C:\mysql\data: MySQL databases are located here. You may relocate this by editing my.ini. Take note that no directory is safe from deletion. This is not the fault of MySQL but that of Windows. MySQL root user has the same privileges as any Windows administrator account.

Other directories: leave them alone






Q&A

What about MySQL root password?

Move on. We will come to it when setting up MySQL Administrator.

Why can't I install MySQL 4.1 in Program Files folder?

Actually you can. A problem might arise when you use another Unix originated application and need to set the path to MySQL server in its configuration file. Unix does not accept a space as a directory name and that requirement might be carried into the Windows version. It will save some typing as well.

I keyed in a root password in Winmysqladmin but I can't log in using Mysqlcc...

That is correct. Winmysqladmin.exe does not set the root password (which is located in mysql table). You should log in with a blank password and change it.

I don't have winmysqladmin!

Use the DOS commands mentioned earlier to install and start MySQL service.

How do I uninstall MySQL?

Run the stop and uninstall commands from DOS. Then use Windows Control Panel to uninstall the application. Take note that the uninstaller will not delete the data directory. You have to manually remove C:\mysql\data.