Thursday, February 23, 2012

Installing Multiple Mysql on same Machine

It took me lot of time figuring out how to install multiple mysql instances on same machine.
So I thought of sharing Process for setting up multiple Mysql on same machine will be useful for somebody looking for such manual...

1. Install Mysql server on that machine
2. Create a folder called xyz anywhere.
3. Create 2-3 folders...say data1, data2 etc inside xyz folder...they will hold the data for respective tables of respective installation.
4. Create 3 files my1.ini, my2.ini, my3.ini inside xyz folder.
5. Find out my.ini of your original Mysql server installation. And copy the content into all 3 ini files.
6. Modify following configurations in all 3 ini files according to your convenience. Here is example..
[client]
# password = your_password
port = 3307
enable-named-pipe
socket = "C:/xampp/mysql/mypipe1"
[mysqld]
port= 3307
socket = "C:/xampp/mysql/mypipe1"
datadir="C:/mysql1/data1"
pid_file="mysql.pid1"
log_error="mysql_error.log1"
log-bin=master1-bin
server-id = 1
innodb_data_home_dir = "C:/mysql1/data1"
innodb_log_group_home_dir = "C:/mysql1/data1"

Each ini file will contain respective unique entry for port, datadir, socket, server-id etc..
7. Copy mySqlInstallationFolder/mysql/data/mysql folder into all 3 folders data1, data2 and data3.
8. Go to comand prompt and run these commands
Mysqlpath\mysql\bin\mysqld --install mysqld1 --defaults-file=yourPath\xyz\my1.ini [ for Windows...u can find equivalent Linux command for installing a new service ]
Mysqlpath\mysql\bin\mysqld --install mysqld2 --defaults-file=yourPath\xyz\my2.ini
Mysqlpath\mysql\bin\mysqld --install mysqld3 --defaults-file=yourPath\xyz\my3.ini

9. Start your respective service ie mysqld1,mysqld2,mysqld3 [these are all different instances of mysql].
10. Login to individual mysql server using following command
mysql -u root -h localhost -P 3307 [change your port name]
mysql -u root -h localhost -P 3307 -p [ if you have password for root ]

7 comments:

  1. Thanks Mukesh, it works great !!

    ReplyDelete
  2. which mysql version u r using?

    ReplyDelete
    Replies
    1. It is version independent. I suppose I might have tried for mysql 5.5 or 5.6.

      Delete
  3. Did this on Windows under MySQL 5.7. For step 8 I had to enclose the path in quotes, as in: Mysqlpath\mysql\bin\mysqld --install mysqld1 --defaults-file="yourPath\xyz\my1.ini"

    For Step 10: mysql --port=3307 --host=127.0.0.1 --user=root --password

    ReplyDelete
  4. If your echo won't connect to wifi Or having any problem to setup Alexa to Wifi then Don't Worry we are here to help you just follow the simple steps which is given on our website. We'll help you to connect Alexa to wifi, connect echo to wifi and amazon echo not connecting to wifi and other problems. For instant help, call us at our amazon echo help number +1-888-745-1666.
    Setup echo
    Setup Echo Dot

    ReplyDelete