In this tutorial we will show steps to upgrade to mysql 5.7 in linux. We have many server which are running on old mysql versions. What we want to do is, without loosing any data we want to upgrade mysql version.
We are using centos 6 as linux system for our servers. Following commands can be used for any linux os like fedora, debian, centos and redhat.
upgrade to mysql 5.7 in linux
First execute following command.
rpm -qa | grep mysql
Make a note of result. It will show you list of mysql programs which are installed on your system. In case of any issue this list will be with you.
Note: Before upgrading mysql version don’t forget to take mysql database backup of all databases.
Now download latest repository from mysql community server.
Go here and download repo https://dev.mysql.com/downloads/repo/yum/
Look for Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package
(mysql57-community-release-el6-7.noarch.rpm) You need to download this rpm.
Using following command you can install mysql 5.7 community repository.
rpm -Uvh mysql57-community-release-el6-7.noarch.rpm
After that stop mysql server using following command.
After that update mysql community server on linux box. use following command.
yum update mysql-community-server
After that install or update following mysql 5.7 dependencies using following command
yum install gcc-c++ gperf uuid-devel libuuid libuuid-devel uuid boost-devel libevent libevent-devel
Install one another dependency of mysql server.
yum install mysql-community-libs-compat
Now your mysql server is updated to 5.7 version. First thing you need to do is check my.cnf file which is mysql configuration file. If my.cnf file is got replaced than put your old file and start mysql server using following command.
if mysql server is not starting than you need to start mysql server in safe mode using bellow command.
I faced many issues while mysql upgrade following is one of them. you can check mysql errrors in /var/log/mysqld.log file. I found following error.
InnoDB: pthread_create returned 11
I solved above issue by changing increase the stack size. I executed following command. which solved my issue.
ulimit -s 8192
mysqld_safe --skip-grant-tables &
Now it is time to upgrade your database to mysql 5.7 version. login to your mysql using root password.
mysql -u root -p
For upgrading your database use bellow command.
mysql_upgrade -u root -p --force
Congratulations! you successfully upgraded mysql version to 5.7 version.