Installing MySQL on Windows

Материал из База знаний Центра ПУСК МФТИ

After installing Apache, then PHP, the third leg is to install MySQL. MySQL appears to be the preferred database for Moodle, but it does have its quirks. You may want to use PostGres, which is an excellent database tool, or MSSQL, or Oracle.

It is assumed here that the file you have downloaded is the mysql-5.1.38-win32.msi file. This installation is for a standalone test server, in preparation for when it is ready to be uploaded to our production site. However, the same principles of installation are applied even to a Windows Server.

Installing the MySQL Server

When downloaded, right click the mysql-5.1.38-win32.msi file (the file I downloaded, but yours may have a different version number.) Select Install and then "Run"

Select "Custom Setup"

Файл:Mysql01.gif
Start MySQL installation process

Change path to what you want, say g:\mySQL so select new path New Folder navigate to G:\ and add mySQL as a destination folder name. (What you use is up to you.)

Файл:Mysql02.gif
Destination path for MySQL installation
Файл:Mysql04.gif
Setting up the destination path

Do not try to change destination of the data folder, it will get frustrating. Click "Install" and it will copy all the files it needs to the destination.

Файл:Mysql05.gif
Start MySQL installation

In some versions of the installer there is a set of ads for MySQL Enterprise version which you can safely ignore.

It will take you to the "Wizard Complete screen, and ask you if you want to configure MySQL now and register.

Файл:Mysql07.gif
Installation Wizard completed

You can always register later, so uncheck the box and click Finish which will take you to the Configuration Wizard.

Configuring MySQL

After installing MySQL, you now need to make it usable in Windows, to configure it to what you need.

Файл:Mysql09.gif
Start MySQL configuration wizard

Click next and it will ask you if you want a "Detailed Configuration" or "Standard Configuration" for our purposes, we want a Detailed Configuration and click Next.

Файл:Mysql10.gif
Start Detailed configuration of MySQL installation

The next screen basically asks for what kind of use are you putting the MySQL server to, for out purposes we want a generic server machine, and click Next

Файл:Mysql11.gif
What server type is going to be used?

Select Multifunctional database here, we do not know what we will want MySQL to be doing next year, so play it safe, select the generic option. Click Next.

Файл:Mysql12.gif
Start MySQL installation

The InnoDB TableSpace Settings can go into the same path as our database. Click Next.

Файл:Mysql13.gif
InnoDB Tablespace settings

For our purposes, we need only set a manual operation for no more than 15 connections. If you were installing a production site, you would want OLTP. Click Next.

Файл:Mysql14.gif
Select the number of concurrent connections

Enable TCP/IP, and accept the default port setting, but make sure you click the Add firewall exception option. Accept the Enable Strict Mode as well. Click Next.

Файл:Mysql15.gif
Setting the networking options

Here we need to remember that Moodle uses a Collation and the UTF-8 character set, so MySQL needs to accommodate this. Select "Manual Selected Default Character Set/Collation" option. From the drop down list, select UTF-8.

Файл:Mysql16.gif
Selecting the Collation and UTF-8 Charset for MySQL

Accept installation as a Windows Service, but unless you are developing a database, you may not think you need to select the "Include Bin Directory in Windows path" option. As a rule of thumb though, you may need to access mySQL from the command line at some stage, probably not, but sometimes, you may. Including this now is a set and forget option.

Файл:Mysql17.gif
Setting the Windows Options

Here you need to enter a password, making sure it is the same password as you are going to use for your Moodle installation. For security purposes though, you may not want to enable root access from a remote machine, nor create an anonymous account.

Файл:Mysql18.gif
Setting the security options

NOTE: Makes sure you can easily remember the password you set here. You wll need to install Moodle properly.

Файл:Mysql19.gif
Ready to execute configuration settings

Thinking over what you have done, are you happy with the options you have selected, of so, select Execute and go and make a tea or a coffee, or what you want, while mySQL installs.

Файл:Mysql21.gif
The end is nigh - Finish to end

When complete, we can look to see if it is all installed properly. We know Apache and PHP are working, so now it is the turn of mySQL.

Testing the MySQL Server Installation

MySQL should now appear in the Start Menu, so you can access mySQL, and MySQL Command line Client.

Файл:Mysql22.gif
Start MySQL installation

which brings up a Windows cmd dialogue box. At the prompt enter your password, and it should respond with "Welcome to the MySQL monitor..." with some more text and commands, ending with the mysql> prompt. If this works, then it is all well.

Файл:Mysql23.gif
Start MySQL command line
Файл:Mysql24.gif
MySQL command line prompt, all is well

Enter exit and that should take you out of the cmd box as well.

You can now prepare to install Moodle.

See also