Tuesday, January 6, 2009

Mysql Multiple Instance

Add mysqld_admin part in /etc/mysql/my.cnf:

mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = multi_admin
password = multi

Add new instance parameters:

socket = /var/run/mysqld/mysql3.sock
port = 3308
pid-file = /var/run/mysqld/
datadir = /var/lib/mysql/data3
language = /usr/share/mysql/english
server-id = 5

Build new Data directory:

mysql_install_db --user=mysql --ldata=/var/lib/mysql/data3

Restart mysql server:

/etc/init.d/mysql restart

Start new instance:

mysqld_multi start 3

Check that is runing:

mysqld_multi report 3

Set the root password for new instance:

mysqladmin -uroot password "NEWPASSWORD" -S /var/run/mysqld/mysql3.sock

Check new instance is available:

mysql -uroot -p -S /var/run/mysqld/mysql3.sock


viraj said...

Thank you for this information. Very helpful. Appreciate it.

pamchi said...

just check the last line in your tutorial, it says

mysql -uroot -p -S /var/run/mysqld/mysql3.sock

and it must be

mysql -u root -p -S /var/run/mysqld/mysql3.sock

For those who only do a copy/paste of the tutorial could have some troubles.


Tehrani said...

But that's right. You could write either -uUSERNAME or -u USERNAME.