Wednesday 10 August 2011

Running Multiple Mysql server

The Complete Installation Process is not listed here.You Can take that from official webpage :dev.mysql.com


Just what we have to do is the start the server (mysqld_safe) with different option's and also this applies for the client(mysql). I have installed the two MySql servers Now i want them to be started with different basedir,datadir,socket etc..



1. I have Installed the One Mysql Server with the apt-get and other as binary.
2. Install the first one Simply as apt-get install mysql-server.
3. The binary Installation is as from
/usr/local/mysql/support-files/$./mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql


Now start the server as running below with options.( mysqld_safe with the various options)


root@administrator-desktop:/etc/mysql# ps -ef | grep mysql
root 6910 6887 0 15:14 pts/5 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf
mysql 7005 6910 0 15:14 pts/5 00:00:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/administrator-desktop.err --pid-file=/var/lib/mysql/administrator-desktop.pid --socket=/var/run/mysqld/mysqld.sock --port=3307
root 7020 6887 0 15:16 pts/5 00:00:00 mysql -p
root 7046 6356 0 15:19 ? 00:00:00 /bin/sh ./mysqld_safe --defaults-file=/etc/mysql/my-medium.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --socket=/tmp/mysql.sock
mysql 7150 7046 0 15:19 ? 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my-medium.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --log-error=/usr/local/mysql/data/administrator-desktop.err --pid-file=/usr/local/mysql/data/administrator-desktop.pid --socket=/tmp/mysql.sock --port=3308
root 7220 7193 0 15:20 pts/4 00:00:00 grep mysql



We also need to edit our my.cnf file for the as we have to start the server with the options of --defaults-file as it include the socket and port.
The socket and port for both the cnf file should different and also all other datadir, basedir .......


Now run your mysql client with --port and --socket option.