MYSQL5.6多实例启动

mkdir -p /data/mysql/3306/{data,log,tmp}
mkdir -p /data/mysql/3307/{data,log,tmp}
mkdir -p /data/mysql/logs/
chown -R mysql. /data/mysql/*

#/etc/my.cnf
[client]
port=3306

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log = /data/mysql/logs/mysqld_multi.log

[mysqld]
user=mysql
explicit_defaults_for_timestamp=true

[mysqld3306]
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql/3306/data
port=3306
server_id=330675
socket=/tmp/mysql_3306.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/3306/log/slow.log
log-error = /data/mysql/3306/log/error.log
binlog_format = row
log-bin = /data/mysql/3306/log/mysql3306_bin

[mysqld3307]
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql/3307/data
port=3307
server_id=330775
socket=/tmp/mysql_3307.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/3307/log/slow.log
log-error = /data/mysql/3307/log/error.log
binlog_format = row
log-bin = /data/mysql/3307/log/mysql3307_bin
————————————————————-

mysqladmin -P3306 -h127.0.0.1 password ‘abcd’
mysqladmin -P3307 -h127.0.0.1 password ‘abcd’

mysql -P3306 -h127.0.0.1 -pabcd -e ‘delete from mysql.user where length(Password)=0’
mysql -P3307 -h127.0.0.1 -pabcd -e ‘delete from mysql.user where length(Password)=0’

mysql -P3306 -h127.0.0.1 -pabcd -e ‘update mysql.user set Host=”%”‘
mysql -P3307 -h127.0.0.1 -pabcd -e ‘update mysql.user set Host=”%”‘

mysql -P3306 -h127.0.0.1 -pabcd -e ‘flush privileges’
mysql -P3307 -h127.0.0.1 -pabcd -e ‘flush privileges’

发表评论

电子邮件地址不会被公开。