Running multiple Databases Servers:
======================================
do the following as root.
1. create directories:
mkdir /var/lib/mysql1
mkdir /var/lib/mysql2
2. change the user and group
chown mysql /var/lib/mysql1
chgrp mysql /var/lib/mysql1
chown mysql /var/lib/mysql2
chgrp mysql /var/lib/mysql2
3. copy my2.cnf to /etc
4. execute the following:
mysql_install_db --user=mysql --datadir=/var/lib/mysql1 --verbose
mysql_install_db --user=mysql --datadir=/var/lib/mysql2 --verbose
5. start databases.
mysqld_multi --config-file=/etc/my2.cnf start 1
mysqld_multi --config-file=/etc/my2.cnf start 2
---
the port for database 1 is 3406
the port for database 2 is 3506.
vim /etc/my2.cnf
[mysqld1]
port=3406
datadir=/var/lib/mysql1
socket=/var/lib/mysql1/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
innodb_data_home_dir = /var/lib/mysql1/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql1/
innodb_log_arch_dir = /var/lib/mysql1/
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqld2]
port=3506
datadir=/var/lib/mysql2
socket=/var/lib/mysql2/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
innodb_data_home_dir = /var/lib/mysql2/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql2/
innodb_log_arch_dir = /var/lib/mysql2/
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqld_safe]
log-error=/var/log/mysqld2.log
pid-file=/var/run/mysqld2/mysqld2.pid
No comments:
Post a Comment