1、配置文件
[root@elk101 system]#cat /data1/myconf/330{7,8,9}/my.cnf
[mysqld]
user=mysql
basedir=/ljbb/app/mysql
datadir=/data1/3307/data
socket=/tmp/mysql3307.sock
port=3307
[mysql]
socket=/tmp/mysql3307.sock
[mysqld]
user=mysql
basedir=/ljbb/app/mysql
datadir=/data1/3308/data
socket=/tmp/mysql3308.sock
port=3308
[mysql]
socket=/tmp/mysql3308.sock
[mysqld]
user=mysql
basedir=/ljbb/app/mysql
datadir=/data1/3309/data
socket=/tmp/mysql3309.sock
port=3309
[mysql]
socket=/tmp/mysql3309.sock
[root@elk101 system]#
2、systemd服务
[root@elk101 system]#cat /etc/systemd/system/mysqld330{7,8,9}.service
[Service]
ExecStart=/ljbb/app/mysql/bin/mysqld --defaults-file=/data1/myconf/3307/my.cnf
[Service]
ExecStart=/ljbb/app/mysql/bin/mysqld --defaults-file=/data1/myconf/3308/my.cnf
[Service]
ExecStart=/ljbb/app/mysql/bin/mysqld --defaults-file=/data1/myconf/3309/my.cnf
3、初始化
mysqld --initialize-insecure --user=mysql --basedir=/ljbb/app/mysql --datadir=/data1/330{7,8,9}/data
4、启动
[root@elk101 system]#systemctl start mysqld330{7,8,9}.service
5、socket连接
mysql -S /tmp/mysql3307.sock
mysql -S /tmp/mysql3308.sock
mysql -S /tmp/mysql3309.sock
6、监听端口
[root@elk101 system]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 80 :::3307 :::*
LISTEN 0 80 :::3308 :::*
LISTEN 0 80 :::3309 :::*