Multiple mysql Instance creation in Linux



To create multiple MySQL instance, follow the given below steps

Login as a root in a system

Step (1): Create a new MySQL data directory.


Step 2: Now give permission and ownership .Here we are taking ownership and permission reference from original /var/lib/mysql data directory.
Note: /var/lib/mysql is by default data directory path





Step 3: Now create a new my3.cnf file and paste the below given contents. We will run the new mysql instance in port no. 3311.

Copy the my.cnf file and make it blank and add below configuration changes.


Step 4 : change the cnf files

Step 5: Now install the database in the new mysql data directory

>
Step 6:
create a log file 
  touch /var/log/mysqld3.log



step 7 : mysqld  --defaults-file=/etc/my3.cnf &

step 8 : grep 'temporary password' /var/log/mysqld.log

step 9 :  mysql -u root -p --socket=/var/lib/mysql3/mysql3.sock

How to start and stop the instance:

Stop:

ps -ef|grep mysql

Kill PID

Warning:Beware to choose mysql pid value 

Start:



Comments

Popular Posts