时间:2021-07-01 10:21:17 帮助过:15人阅读
3- 初始化多实例数据库
mv /etc/my.cnf /etc/my.cnf.bak
mysqld --initialize-insecure --user=mysql --datadir=/data/mysql3307/data --basedir=/application/mysql
mysqld --initialize-insecure --user=mysql --datadir=/data/mysql3308/data --basedir=/application/mysql
mysqld --initialize-insecure --user=mysql --datadir=/data/mysql3309/data --basedir=/application/mysql
4- systemctl启动数据库配置
[root@db01 ~]# cat /etc/systemd/system/mysqld3307.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
# 修改为:--defaults-file=/data/mysql3307/my.cnf
ExecStart=/application/mysql/bin/mysqld --defaults-file=/data/mysql3307/my.cnf
LimitNOFILE = 5000
EOF
(1)目录授权
[root@db01 ~]# chown -R mysql.mysql /data
(2) 启动数据库
systemctl start mysqld3307.service
systemctl start mysqld3308.service
systemctl start mysqld3309.service
5- 验证多实例
netstat -lnp|grep 330
mysql -S /data/3307/mysql.sock -e "select @@server_id"
mysql -S /data/3308/mysql.sock -e "select @@server_id"
mysql -S /data/3309/mysql.sock -e "select @@server_id"
mysql 多实例构建
标签:sock not chown alt stat emd service get syslog