Loading

升级MySQL至最新版本

yum 源安装的进行更新

# 下载安装yum源
cd /usr/local/src
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
# 若只升级至5.7则进行修改 8.0无需修改
cd /etc/yum.repos.d
# 编辑该源,将5.7下的启用属性改为1; 8.0下的改为0
vi mysql-community.repo
# 开始更新
yum makecache
yum update mysql-server mysql -y

编译安装的进行更新

# 下载安装yum源
cd /usr/local/src
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
# 若只升级至5.7则进行修改 8.0无需修改
cd /etc/yum.repos.d
# 编辑该源,将5.7下的启用属性改为1; 8.0下的改为0
vi mysql-community.repo

# 开始更新
yum makecache
yum install mysql-server mysql -y 
# 如果之前用yum更新过,建议自己看一下rpm备份的文件
cp /etc/my.cnf.rpmsave /etc/my.cnf

# 如果使用编译安装到/usr/local/mysql/data目录,启动报错的,可以尝试将数据迁移至/var/lib/mysql再次启动
\cp -r /usr/local/mysql/data/* /var/lib/mysql
chmod 777 -R /var/lib/mysql

# 启动&自启
systemctl restart mysqld
systemctl enable mysqld
posted @ 2021-05-31 11:14  寒烟濡雨  阅读(753)  评论(0编辑  收藏  举报

Loading