Mysql默认启动3306端口实例。现需求再启动一个3307端口实例。
创建3307实例数据所在目录:
mkdir -p /data/mysqldata/mysql3307
mkdir -p /data/mysqldata/mysql3307/data
chown -R mysql:mysql /data/mysqldata/mysql3307
生成数据:
mysql_install_db --basedir=/data/mysqldata/mysql3307 --datadir=/data/mysqldata/mysql3307/data --user=mysql
生成新的配置文件:
vi /data/mysqldata/mysql3307/my.cnf
启动实例:
mysqld_safe --defaults-file=/data/mysqldata/mysql3307/my.cnf
附上my.cnf内容:
[client]
port = 3307
socket = /data/mysqldata/mysql3307/mysqld.sock
[mysqld]
user = mysql
pid-file = /data/mysqldata/mysql3307/mysqld.pid
socket = /data/mysqldata/mysql3307/mysqld.sock
port = 3307
basedir = /data/mysqldata/mysql3307
datadir = /data/mysqldata/mysql3307/data
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 0.0.0.0
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
#log_error = /data/mysqldata/mysql3307/error.log
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
[mysqld_safe]
syslog
skip-syslog=false
syslog-tag=3307