mysqld_multi创建管理多实例
#配置文件
cat /etc/my.cnfEOF
[客户]
socket=/tmp/mysql.sock
[mysql]
提示=(\u@\h) [\d]\_
不自动重挂
[mysqld]
basedir=/usr/local/mysql
端口=3306
用户=mysql
binlog_format=row
跳过名称解析
服务器id=6
gtid-模式=开
强制-gtid-一致性=真
log_error=mysql.err
日志从属更新=1
[mysqld_multi]
mysqld=/usr/local/MySQL/bin/mysqld _ safe
MySQL管理员=/usr/local/MySQL/bin/MySQL管理员
log=/usr/local/MySQL/MySQL d _ multi。原木
[mysqld7]
端口=3307
服务器id=7
datadir=/data/3307/data
socket=/data/3307/mysql.sock
log_bin=/data/3307/mysql-bin
[mysqld8]
端口=3308
服务器id=8
datadir=/data/3308/data
socket=/data/3308/mysql.sock
log_bin=/data/3308/mysql-bin
[mysqld9]
端口=3309
服务器id=9
datadir=/data/3309/data
socket=/data/3309/mysql.sock
log_bin=/data/3309/mysql-bin
[mysqld10]
端口=3310
服务器id=10
datadir=/data/3310/data
socket=/data/3310/mysql.sock
log_bin=/data/3310/mysql-bin
文件结束
#创建目录和授权
mkdir -p /data/3306/data
mkdir -p /data/3307/data
mkdir -p /data/3308/data
mkdir -p /data/3309/data
mkdir -p /data/3310/data
chown -R mysql.mysql /data/3306
chown -R mysql.mysql /data/3307
chown -R mysql.mysql /data/3308
chown -R mysql.mysql /data/3309
chown -R mysql.mysql /data/3310
#初始化
/usr/local/MySQL/bin/MySQL-initialize-unsecurity-basedir=/usr/local/MySQL/-datadir=/data/3306/data
/usr/local/MySQL/bin/MySQL-initialize-unsecurity-basedir=/usr/local/MySQL/-datadir=/data/3307/data
/usr/local/MySQL/bin/MySQL-initialize-unsecurity-basedir=/usr/local/MySQL/-datadir=/data/3308/data
/usr/local/MySQL/bin/MySQL-initialize-unsecurity-basedir=/usr/local/MySQL/-datadir=/data/3309/data
/usr/local/MySQL/bin/MySQL-initialize-unsecurity-basedir=/usr/local/MySQL/-datadir=/data/3310/data
#启动多实例
mysqld_multi start 7,8,9,10
#验证
" mysql -S /data/3307/mysql.sock -e "显示像"服务器id "这样的变量
" mysql -S /data/3308/mysql.sock -e "显示像"服务器id "这样的变量
" mysql -S /data/3309/mysql.sock -e "显示像"服务器id "这样的变量
" mysql -S /data/3310/mysql.sock -e "显示像"服务器id "这样的变量
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/143790.html