Percona-XtraBackup Linux安装
1 下载tar包
Percona XtraBackup官网地址:https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/
选择对应的版本号和系统
将离线下载的tar上传至/usr/local/src目录下或者其他目录下
2、解压并创建软连接:
tar zxvf percona-xtrabackup-2.4.20-Linux-x86_64.el8.tar.gz
mv percona-xtrabackup-2.4.20-Linux-x86_64 /usr/local/xtrabackup
ln -s /usr/local/xtrabackup/bin/* /usr/bin/
在线安装:yum -y install percona-xtrabackup-24.x86_64 //安装percona
3、查看版本:
# xtrabackup --version
xtrabackup version 2.4.7 based on MySQL server 5.7.13 Linux (x86_64) (revision id: 6f7a799)
qpress安装
1.下载 qpress-11-1.el8.x86_64.rpm 地址:http://www.rpmfind.net/linux/rpm2html/search.php?query=qpress(x86-64)
2.安装软件:执行rpm -ivh rpm包名
mysql安装
1. yum install libncurses*
创建MySQL文件 mkdir /usr/local/mysql
useradd -s /bin/false -d /usr/local/mysql mysql(该步骤出错可跳过)
2.解压 tar -xvzf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz -C /usr/local/mysql/
cd /usr/local/mysql/mysql-5.7.29-linux-glibc2.12-x86_64/
mv * ../
cd ..
rmdir mysql-5.7.29-linux-glibc2.12-x86_64/
mkdir data
chown -R mysql.mysql ../mysql
cd bin
./mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
安装完成后在最后会显示root密码
3. cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysqld
4. MySQL配置文件/etc/my.cnf中内容如下:没有就打开etc创建一个 touch /my.cnf
[mysqld]
port = 3306
basedir = /usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
pid-file=/usr/local/mysql/data/mysql.pid
log-error=/usr/local/mysql/data/error.log
character_set_server=utf8
user=mysql
max_connections=1500
symbolic-links=0
# 东八区时区,北京时区
default-time-zone = '+8:00'
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# 导入包允许的大小设置
max_allowed_packet=1024M
# 忽略表名大小写;1表示忽略大小写,0表示解析大小写
lower_case_table_names=1(8.0的版本不需要该项,会出现pid不存在的错误)
!includedir /etc/my.cnf.d
5. 添加环境变量
vim /etc/profile
# mysql
PATH=/usr/local/mysql/bin:$PATH
保存退出后,使用source /etc/profile使其生效。
6、启动服务并登陆
常用命令
# 启动命令
service mysqld start 或者 /etc/init.d/mysqld start
# 停止命令
service mysqld stop 或者 /etc/init.d/mysqld stop
# 重启命令
service mysqld restart 或者 /etc/init.d/mysqld restart
8 登陆命令
mysql -uroot -p
修改密码并允许远程连接
mysql> set password=password('123456');
mysql> use mysql;
mysql> update user set host='%' where user='root';
mysql> flush privileges;
如果远程还连接不上,看下是否防火墙开启了?
# 永久开放3306端口
firewall-cmd --permanent --zone=public --add-port=3306/tcp
# 重启防火墙
systemctl restart firewalld
# 检测设定是否生效
iptables -nL | grep 3306
9、MySQL自启
# 查看MySQL是否自启
systemctl is-enabled mysqld
显示disabled,MySQL默认非自启
# 开启自启
systemctl enable mysqld