In this Blog we are going to see how to upgrade or update Mysql 5.1 to Mysql 5.6.
We can't upgrade mysql 5.1 to 5.6 directly. So We first upgrade mysql 5.1 to 5.5 and then mysql 5.5 to mysql 5.6.
Note:- All command are executed by root privileges.
Note:- All command are executed by root privileges.
Mysql 5.1 to 5.5 Upgradation
Step 1:-
Take backup of /var/lib/mysql directory.
Take backup of /etc/my.cnf file.
Take manually DB dump of your database.
To take mannully DB dump of your database use given command.
mysqldump --routines -u"USERNAME" -p"PASSWORD" > Filname.sql
Step 2:-
Check installed mysql packeges with following command,
rpm -aq | grep -i mysql
You will get output like
[huntechpedia@Centos ~]$ rpm -aq | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
Step 3:-
Install and activate the REMI and EPEL rpm repositories.
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Edit /etc/yum.repos.d/remi.repo file using vim
vim /etc/yum.repos.d/remi.repo
Do following changes in file,
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Step 4:-
Now we update Mysql 5.1 to Mysql 5.5
yum update -y mysql*
Now we can verify using
rpm -aq | grep mysql
You can see in output mysql update to 5.5.X version. (X is subversion)
mysql-5.5.45-1.el6.remi.x86_64
compat-mysql51-5.1.54-1.el6.remi.x86_64
mysql-libs-5.5.45-1.el6.remi.x86_64
mysql-server-5.5.45-1.el6.remi.x86_64
You check mysql version using mysql -V command.
Verify by login to mysql
mysql -uroot -A
If root have password then use below command
mysql -uroot -pPassword -A
Then you can see output something like
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.45 MySQL Community Server (GPL) by Remi
That's it. We have successfully updated mysql 5.1 to mysql 5.5.
Mysql 5.5 to 5.6 Upgradation
Check mysql installed packages
Remove mysql 5.5 packages
Step 3:-
Install Mysql 5.6 packages which we have downloaded before.
Now rename /var/lib/mysql to /var/lib/mysql_56clean directory
Copy /var/lib/mysql_55 as /var/lib/mysql
Change ownership of /var/lib/mysql directory.
Start and enable Mysql Service
After this if you get mysql PID Error then execute below command.
Now in last execute mysql upgrade command.
Done!!!
We have successfully update mysql 5.5 to 5.6.
I hope this help you. Please share and let me know in comment. See you in next blog
Thank You.
Step 1:-
Download mysql 5.6.X -server, client and shared rpm packages.
Stop mysql service
service mysqld stop
OR
systemctl stop mysqld
Step 2:-
Now rename of /var/lib/mysql/ directory.
mv /var/lib/mysql /var/lib/mysql_55
Check mysql installed packages
rpm -aq | grep mysql
Remove mysql 5.5 packages
yum remove -y mysql-server*
Yum remove -y mysql-client*
Yum remove -y mysql-shared*
rpm -e --nodeps mysql-libs
Step 3:-
Install Mysql 5.6 packages which we have downloaded before.
rpm -ivh MySQL-shared-5.6.10-1.el6.x86_64.rpm
rpm -ivh MySQL-client-5.6.10-1.el6.x86_64.rpm
rpm -ivh MySQL-server-5.6.10-1.el6.x86_64.rpm
Now rename /var/lib/mysql to /var/lib/mysql_56clean directory
mv /var/lib/mysql /var/lib/mysql_56clean
Copy /var/lib/mysql_55 as /var/lib/mysql
cp -R /var/lib/mysql_55 /var/lib/mysql
Change ownership of /var/lib/mysql directory.
chown -R mysql:mysql /var/lib/mysql
Start and enable Mysql Service
service mysql start
chkconfig mysql on
OR
systemctl start mysql
systemctl enable mysql
After this if you get mysql PID Error then execute below command.
restorecon -r /var/lib/mysql
Now in last execute mysql upgrade command.
mysql_upgrade -uroot
Done!!!
We have successfully update mysql 5.5 to 5.6.
I hope this help you. Please share and let me know in comment. See you in next blog
Thank You.


0 Comments