Windows: Multiple Instances of MySQL – Error can not create hostname.lower-test – SOLVED

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:
    [mysqld]
    # The TCP/IP Port the MySQL Server will listen on
    port=3307
    #Path to the database root
    datadir="c:/new/location/Data/"
    #*** INNODB Specific options ***
    innodb_data_home_dir="c:/new/location/innodb"
  • adding the new instance as a service
    run command:
    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
c:\new\location\data
c:\new\location\innodb


I started the service and received the same error.
SOLUTION
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

Advertisements
Tagged , ,

3 thoughts on “Windows: Multiple Instances of MySQL – Error can not create hostname.lower-test – SOLVED

  1. […] resztę artykułu: Windows: Multiple Instances of MySQL – Error can not create … a-clean-, clean-, for-one, getting-multiple, multiple-instances-, usually-need, windows, […]

  2. rani says:

    Hi.
    I am trying to install multiple instances in my machine and it is very urgent as i am new to this i am not able reproduce all the steps that u mentioned here. can you please explain in detail. As default MySql is in C:\Programs Files\MySql. It would be great pleasure if you can help me.

    Thanks with Regards
    Rani

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: