???
哈喽!大家好,我是【】,江湖人称jeames007,10年DBA工作经验
一位上进心十足的【大数据领域博主】!???
中国DBA联盟(ACDU)成员,目前从事DBA及程序编程
擅长主流数据Oracle、MySQL、PG 运维开发,备份恢复,安装迁移,性能优化、故障应急处理等。
如果有对【数据库】感兴趣的【小可爱】,欢迎关注【】???
感谢各位大可爱小可爱!
最近客户的数据要做升级,从5.7的版本升级到8.0,本文详细的概述了全过程
[root@jeames ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 (Ootpa)
[root@jeames ~]# systemctl status firewalld
??? 关闭防火墙
systemctl stop firewalld
??? 取消开机自启动
[root@jeames ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@jeames ~]# more /etc/sysconfig/selinux
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
???重启机器即可
[root@jeames ~]# sestatus
SELinux status: disabled
[root@jeames ~]# getenforce
Disabled
??? 安装包
mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
[root@jeames ~]# mkdir /soft
#二进制包解压
[root@jeames ~]# mkdir -p /usr/local/mysqlsoft
[root@jeames ~]# cd /soft/
tar -zxvf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz -C /usr/local/mysqlsoft
tar -Jxf mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz -C /usr/local/mysqlsoft
#快捷方式创建
[root@jeames ~]# mkdir -p /usr/local/mysql57
[root@jeames ~]# mkdir -p /usr/local/mysql80
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql:mysql /usr/local/mysqlsoft
[root@jeames soft]# passwd mysql
# 创建挂载路径
mkdir -p /mnt/cdrom
# 挂载系统镜像光盘到指定目录
mount -t iso9660 /dev/sr0 /mnt/cdrom
cd /etc/yum.repos.d
# 修改yum源配置文件
vi rhel8-local.repo
[localREPO]
name=localhost8
baseurl=file:///mnt/cdrom/BaseOS
enable=1
gpgcheck=0
[localREPO_APP]
name=localhost8_app
baseurl=file:///mnt/cdrom/AppStream
enable=1
gpgcheck=0
##安装依赖包
yum install libaio
yum -y install perl perl-devel
yum install libncurses*
yum -y install autoconf
yum -y install numactl.x86_64
chown -R mysql.mysql /usr/local/mysql50
##静默安装
/usr/local/mysql57/mysql5730/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql57/mysql5730 --datadir=/usr/local/mysql57/mysql5730/data
##配环境变量
echo “export PATH=$PATH:/usr/local/mysql57/mysql5730/bin” >> /root/.bashrc
source /root/.bashrc
??? mysqld_safe &
??? 新增用户及修改密码
mysql> select user,host,authentication_string from mysql.user;
##新增远程用户
mysql> grant all on . to root@‘%’ identified by ‘root’ with grant option;
mysql> flush privileges;
##修改本地密码
set password for root@‘localhost’=password(‘root’);
mysql> flush privileges;
mysql> show variables like ‘innodb_fast_shutdown%’;
±---------------------±------+
| Variable_name | Value |
±---------------------±------+
| innodb_fast_shutdown | 1 |
±---------------------±------+
1 row in set (0.01 sec)
内存数据全部落盘
mysql> set global innodb_fast_shutdown=0;
mysql> create database jeames;
Query OK, 1 row affected (0.00 sec)
#关闭Mysql
mysqladmin -uroot -proot shutdown
chown -R mysql.mysql /usr/local/mysql80
##静默安装MySQL
/usr/local/mysql80/mysql8019/bin/mysqld --initialize-insecure --user=mysql
–basedir=/usr/local/mysql80/mysql8019 --datadir=/usr/local/mysql80/mysql8019/data
??? 指向5.7的数据文件及错误日志路径
vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql80/mysql8019
datadir=/usr/local/mysql57/mysql5730/data
port=3306
log-error=/usr/local/mysql57/mysql5730/data/log.err
server_id=80193306
log-bin
default_authentication_plugin=mysql_native_password
character_set_server=utf8mb4
cd /usr/local/mysql80/mysql8019/bin
mysqld_safe &
##输入密码为:5.7版本的密码(root)
echo “export PATH=$PATH:/usr/local/mysql80/mysql8019/bin” >> /root/.bashrc
source /root/.bashrc
??? 此处记得要删除原来的环境变量
yum remove -y mysql --nodeps
yum remove -y mysql-community-* --nodeps
rpm -qa|grep mysql|xargs rpm -e --nodeps
rpm -qa | grep mysql
rpm -e mysql-community-embedded-devel-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-libs-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-embedded-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-embedded-compat-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-common-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-devel-5.7.30-1.el7.x86_64 --nodeps
rpm -e mysql-community-libs-compat-5.7.30-1.el7.x86_64 --nodeps
rm -rf /var/lib/mysql
rm -rf /var/log/mysqld.log
rm -rf /usr/lib/mysql
rm -rf /usr/include/mysql
rm -rf /etc/my.cnf
rm -rf /run/lock/subsys/mysql
find / -iname mysql
大家点赞、收藏、关注、评论啦 ???微信公众号???
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦