Today we are going to see how to upgrade Mysql 5.6 to Mysql 8. We can't Directly update mysql 5.6 to mysq 8. It is not suggested because we can't skip major version update like mysql 5.7. So we first we update mysql 5.6 to mysql 5.7 then mysql 5.7 to mysql 8. So Let's begin.
Steps to do before start upgradation :-
Take backup of /var/lib/mysql directory
Take backup of /etc/my.cnf file
Take backup of all databases.
Take backup of postfix directory(Because we remove existing mysql then in dependencies postfix also removed. )
Note:- All command are executed by root privileges.
Note:- All command are executed by root privileges.
Steps
to update Mysql 5.6 to Mysql 5.7
Step 1:-
make a backup file of /var/lib/mysql directory.
cp /var/lib/mysql /var/lib/mysql.original
Download mysql 5.7 community release rpm file from .
wget https://repo.mysql.com/mysql57-community-release-el7.rpm
Now remove mysql community package of mysql 5.6
yum remove mysql-community-release
Step 2:-
Now install downloaded mysql 5.7 community release package
rpm -ivh mysql57-community-release-el7.rpm
Now update the mysql and start it service
yum update mysql
systemctl start mysqld
Now execute mysql upgrade command
mysql_upgrade -u(username) -p
Now check mysql version.
mysql -V
Its showing you Version 5.7.
Steps to update Mysql 5.7 to Mysql 8
Step 1:-
Take backup of /etc/my.cnf file.
By default mysql 8 enable bin log. If server crash then Using bin log you can recover database. But It take too much storage space. You can skip this adding skip config in my.cnf
vim /etc/my.cnf
Now add skip=log-bin at the end of file
Step 2:-
Check Mysql 8 repo is present or not.
Now disable mysql 5.7 repo
Now enable mysql 8 repo
Step 3:-
Now update mysql
Now we are going to start mysql service
Now upgrade mysql using following command
Now check mysql version.
Its showing you Version 8.
Done!! We have successfully upgraded MySql 5.6 to MySql 8.
I hope this helped you. let me know suggestions in comment box.
Thank you. See you in next blog. 😀
Step 2:-
Check Mysql 8 repo is present or not.
yum repolist all | grep mysql
Now disable mysql 5.7 repo
yum-config-manager --disable mysql57-community
Now enable mysql 8 repo
yum-config-manager --enable mysql8-community
Step 3:-
Now update mysql
yum update mysql
Now we are going to start mysql service
systemctl start mysqld
Now upgrade mysql using following command
mysql_upgrade -u(username) -p
Now check mysql version.
mysql -V
Its showing you Version 8.
Done!! We have successfully upgraded MySql 5.6 to MySql 8.
I hope this helped you. let me know suggestions in comment box.
Thank you. See you in next blog. 😀


3 Comments
Good Job...!!!
ReplyDeleteThank You.
Deleteyum-config-manager --enable mysql8-community
ReplyDeleteshould be mysql80-community by now