Today, I went about getting multiple instances of MySQL running on my Windows 7 machine.
You may be wondering why do you need multiple instances. Well for one thing, when debugging, you will usually need to work with a clean configuration otherwise, you can get unexpected results because of some configuration that you did a while ago for application x and now application y complains about it.
So I went through,
creating a new my.ini configuration ( i made a copy of my current one).
The following needed to be pointed to a different location than the current instance:
# The TCP/IP Port the MySQL Server will listen on
#Path to the database root
#*** INNODB Specific options ***
- adding the new instance as a service
mysqld-nt --install-manual MySQL_Instance2 --defaults0-file=c:/install/folder/mysql/my-instance2.ini
- starting the service
net start mysql_Instance2
This is when i got this error
Can't create test file C:\new\location\Data\hostname.lower-test
So i created the folders
I started the service and received the same error.
Turns out that, the
mysql database needs to exist in the data folder.
- You can copy you current mysql database over (but this will contain all the changes you have made so far)
To get a fresh copy, download the no-install package from MySQL.
- Unzip it
- Copy and paste the contents of the location/unzipped/mysql/data to /new/location/data
- Start the service and you are good to go.
You now have two instances running.
To connect to the new instance, use
mysql -u root -P 3307