MySQL 多实例部署 xtrabackup备份与恢复

MySQL 多实例部署

1.下载安装包

[root@localhost ~]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz

[root@localhost ~]# ls
anaconda-ks.cfg  mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz

2.解压至/usr/local

[root@localhost ~]# tar -xf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@localhost ~]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  mysql-5.7.35-linux-glibc2.12-x86_64  sbin  share  src

3.做mysql目录的软连接,并更改其属主属组

[root@localhost local]# ln -sv mysql-5.7.35-linux-glibc2.12-x86_64/ mysql
"mysql" -> "mysql-5.7.35-linux-glibc2.12-x86_64/"
[root@localhost local]# ll
总用量 0
drwxr-xr-x. 2 root root   6 4月  11 2018 bin
drwxr-xr-x. 2 root root   6 4月  11 2018 etc
drwxr-xr-x. 2 root root   6 4月  11 2018 games
drwxr-xr-x. 2 root root   6 4月  11 2018 include
drwxr-xr-x. 2 root root   6 4月  11 2018 lib
drwxr-xr-x. 2 root root   6 4月  11 2018 lib64
drwxr-xr-x. 2 root root   6 4月  11 2018 libexec
lrwxrwxrwx. 1 root root  36 8月  27 12:42 mysql -> mysql-5.7.35-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 root root 129 8月  27 12:41 mysql-5.7.35-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root   6 4月  11 2018 sbin
drwxr-xr-x. 5 root root  49 4月  21 19:36 share
drwxr-xr-x. 2 root root   6 4月  11 2018 src

[root@localhost local]# chown -R mysql.mysql mysql
[root@localhost local]# ll -d mysql
lrwxrwxrwx. 1 mysql mysql 36 8月  29 05:50 mysql -> mysql-5.7.35-linux-glibc2.12-x86_64/

4.环境变量

[root@localhost local]# vim /etc/profile.d/mysql.sh
[root@localhost local]# cat /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
[root@localhost local]# source /etc/profile.d/mysql.sh 
[root@localhost local]# which mysql
/usr/local/mysql/bin/mysql

5.创建各实例存放的目录

[root@localhost ]# mkdir -p /opt/data/{3306,3307,3308}
[root@localhost ]# ls /opt/data/
3306  3307  3308

6.初始化各个实例

3306

[root@localhost profile.d]#  mysqld --initialize --datadir=/opt/data/3306 --user=mysql
2021-08-29T10:22:56.524466Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-29T10:22:56.692402Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-08-29T10:22:56.721919Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-08-29T10:22:56.777888Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 13e7f1c7-08b3-11ec-aed0-000c2988823d.
2021-08-29T10:22:56.778394Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-08-29T10:22:57.784376Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2021-08-29T10:22:57.784497Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2021-08-29T10:22:57.784999Z 0 [Warning] CA certificate ca.pem is self signed.
2021-08-29T10:22:57.842963Z 1 [Note] A temporary password is generated for root@localhost: ;ahco8p#)#L,

//保存临时密码
[root@localhost data]# echo ';ahco8p#)#L,' > 06passwd

330

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值