Upgrade MySQL 5.5 to 5.7 on CentOS 6

# Make sure yum is up-to-date
yum update yum

# Install yum-utils (it provides yum-config-manager)
yum install yum-utils

# Backup: dump all databases to all_dbs.sql
mysqldump --lock-all-tables --all-databases -uroot -ped8a5f47cbf39f0b5eda6715c85c0ae0 >/root/all_dbs.sql

# Stop MySQL daemon
service mysqld stop

# Download latest MySQL for CentOS 6
wget https://dev.mysql.com/get/mysql80-community-release-el6-2.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el6-2.noarch.rpm
yum repolist all | grep mysql
sudo yum-config-manager --enable mysql57-community
sudo yum-config-manager --disable mysql80-community
yum update mysql

# Start MySQL
service mysqld start
# If you get any errors you have to remove deprecated variables in etc/my.cnf

# Upgrade existing databases
mysql_upgrade -uroot -p

# Test:
 mysql -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 460
Server version: 5.7.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp