Note: You are currently viewing documentation for Moodle 3.8. Up-to-date documentation for the latest stable version of Moodle may be available here: Installing MySQL on Windows.

Installing MySQL on Windows

From MoodleDocs
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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"

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.)

Destination path for MySQL installation
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.

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.

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.

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.

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

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.

Start MySQL installation

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

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.

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.

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.

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 general 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.

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.

Setting the security options

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

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.

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 acess mySQL, and MySQL Command line Client.

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.

Start MySQL command line
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