解压安装包 cd /usr/local tar xvf Mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz mv mysql-8.0.12-linux-glibc2.12-
解压安装包
cd /usr/local
tar xvf Mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz
mv mysql-8.0.12-linux-glibc2.12-x86_64 mysql
cd mysql/
mkdir conf
export PATH=$PATH:/usr/local/mysql/bin
实例1配置文件 my00.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/var/lib/mysql00
Socket=/tmp/mysql00.sock
symbolic-links=0
port=3306
mysqlx_port=33060
[mysqld_safe]
log-error=/var/log/mysqld00.log
pid-file=/var/lib/mysql00/mysqld.pid
实例2配置文件 my01.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/var/lib/mysql01
socket=/tmp/mysql01.sock
symbolic-links=0
port=3307
mysqlx_port=33070
[mysqld_safe]
log-error=/var/log/mysqld01.log
pid-file=/var/lib/mysql01/mysqld.pid
实例3配置文件 my02.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/var/lib/mysql02
socket=/tmp/mysql02.sock
symbolic-links=0
port=3308
mysqlx_port=33080
[mysqld_safe]
log-error=/var/log/mysqld02.log
pid-file=/var/lib/mysql02/mysqld.pid
初始化实例
mysqld --defaults-file=/usr/local/mysql/conf/my00.cnf --initialize --user=mysql
mysqld --defaults-file=/usr/local/mysql/conf/my01.cnf --initialize --user=mysql
mysqld --defaults-file=/usr/local/mysql/conf/my02.cnf --initialize --user=mysql
启动实例
mysqld_safe --defaults-file=/usr/local/mysql/conf/my00.cnf --user=mysql &
mysqld_safe --defaults-file=/usr/local/mysql/conf/my01.cnf --user=mysql &
mysqld_safe --defaults-file=/usr/local/mysql/conf/my02.cnf --user=mysql &
修改密码
mysql -S /tmp/mysql00.sock -u root -p
ALTER USER root@'localhost' IDENTIFIED BY 'MySQL8.0';
mysql -S /tmp/mysql01.sock -u root -p
ALTER USER root@'localhost' IDENTIFIED BY 'MySQL8.0';
mysql -S /tmp/mysql02.sock -u root -p
ALTER USER root@'localhost' IDENTIFIED BY 'MySQL8.0';
关闭实例
mysqladmin -S /tmp/mysql00.sock -u root -pMySQL8.0 shutdown
mysqladmin -S /tmp/mysql01.sock -u root -pMySQL8.0 shutdown
mysqladmin -S /tmp/mysql02.sock -u root -pMySQL8.0 shutdown
注意:账号 root@'locahost' 使用 socket 连接数据库
参考文档:在Unix上运行多个MySQL实例
--结束END--
本文标题: 通过 MySQL 8.0 二进制安装包部署多实例
本文链接: https://lsjlt.com/news/36883.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0