数据库运维
记录DBA学习成长历程

8.MySQL 8.0多实例的配置应用

文章目录

1  同版本多实例部署

—1.1 配置文件准备

mkdir -p /data/3307/data /data/3308/data
chown -R mysql.mysql /data
cp /etc/my.cnf /etc/my3307.cnf
cp /etc/my.cnf /etc/my3308.cnf
cat /etc/my3307.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/data/3307/data
port=3307
socket=/tmp/mysql3307.sock
[root@localhost ~]# cat /etc/my3308.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/data/3308/data
port=3308
socket=/tmp/mysql3308.sock

—1.2 数据初始化

mysqld --defaults-file=/etc/my3307.cnf --initialize-insecure
mysqld --defaults-file=/etc/my3308.cnf --initialize-insecure

—1.3 启动脚本验证

mysqld_safe --defaults-file=/etc/my3307.cnf  &
mysql -S /tmp/mysql3307.sock
Server version: 8.0.24 MySQL Community Server - GPL
mysqld_safe --defaults-file=/etc/my3308.cnf  & 
mysql -S /tmp/mysql3308.sock
Server version: 8.0.24 MySQL Community Server - GPL
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
赞(1)
MySQL学习笔记 » 8.MySQL 8.0多实例的配置应用