Multiple MySQL Instances

I have seen a lot of versions of this in the web but I decided to create my own copy for ease of setup and simplicity.

First, download the file “mysql55rev.rar” as seen in this post then extract it somewhere in your harddrive.

Follow these steps:

note: extract-dir is the location which you extracted the archive
edit [extract-dir]\my.ini to match your prefernces

[cc lang=”dos” tab_size=”2″ lines=”-1″ first_line=”51″]
[client]

port=3307

[mysql]

default-character-set=utf8

# SERVER SECTION
# ———————————————————————-
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3307
[/cc]
[cc lang=”dos” tab_size=”2″ lines=”-1″ first_line=”73″]
#Path to installation directory. All paths are usually resolved relative to this.
basedir=”[extract-dir]”

#Path to the database root
datadir=”[extract-dir]/data”
[/cc]

commands via the windows command line (cmd)
[cc lang=”dos” tab_size=”2″ lines=”-1″]
[extract-dir]\bin\mysqld.exe –install “mysql3307″ –defaults-file=”[extract-dir]\my.ini”
net start mysql3307
[/cc]

use this code if you wish to disable and uninstall the mysql instance
[cc lang=”dos” tab_size=”2″ lines=”-1″]
net stop mysql3307
[extract-dir]\bin\mysqld.exe –remove “mysql3307”
[/cc]

Credentials needed to access the database are included in the archive.
(download: mysql55rev2)


If you wish to create just a separate instance and you already have the binaries, you don’t have to copy the binaries again, instead, just create a new my.ini and specify a different port and data directory. On a side-note, if you encounter an error like “Could not locate mysql.user” when trying to start the server, you need to copy the mysql folder and the performance_schema folder located in the [extract-dir]\data folder from your existing mysql instance to the new instance data folder.


After you have installed the mysql instance as a service via mysqld.exe –install, you can now see the installed service in windows, you can start/stop them manually from here as well.

open the services window:

manually configure the installed mysql instances:


If you have downloaded the mariadb, you can install a new instance keeping the existing binaries following the instructions at the beginning of this configuration file. You may also use this configuration file as basis of your default my.cnf.


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.