17
Nov

mysql multi instance

   Posted by: admin   in Mẹo vặt của hiếu râu

mkdir -p /var/lib/mysql2
chown mysql:mysql mysql2

cp -p /etc/my.cnf /etc/my2.cnf
vi my2.cnf

[mysqld]
datadir=/var/lib/mysql2
socket=/var/lib/mysql/mysql2.sock
port=3337

[mysqld_safe]
log-error=/var/log/mysqld2.log
pid-file=/var/run/mysqld/mysqld2.pid


mysql_install_db --user=mysql --datadir=/var/lib/mysql2

mysqld_safe --defaults-file=/etc/my2.cnf &
netstat -antp | grep 3337

mysqladmin -S /var/lib/mysql/mysql2.sock shutdown -p
mysql -S /var/lib/mysql/mysql2.sock -u root -p

This entry was posted on Tuesday, November 17th, 2015 at 5:06 pm and is filed under Mẹo vặt của hiếu râu. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed at this time.