MySQL 5.5.11 Installation Tutorial – Step One
An application that I’m looking to install has set MySQL 5.5+ as an installation requirement. This tutorial has spawned out of three days of attempting to get MySQL upgraded from 5.1 to 5.5. Since this was the best tutorial that I was able to find (http://www.ovaistariq.net/490/a-step-by-step-guide-to-upgrading-to-mysql-5-5/), I’ll give Ovais Tariq a plug here. Although the Ovais Tariq tutorial was very informative and helpful, it didn’t actually work for me. Although I do feel that it got close, so I’m rewriting it here with my experiences to helpfully assist some others.
I’ll be breaking this tutorial down into two parts: the first part is backing up and removing mysql from your current server; the second part of this tutorial is the installation of MySQL 5.5.11, found here.
Backup the MySQL configuration
$ mkdir /root/mysql-5.1-conf
$ cp -R /etc/mysql/ /root/mysql-5.1-conf
Backup the data directory
We will be backing up the data in the form of SQL dump as well as by copying the data files over to a safe place, just to be 100% sure about the data not getting lost.
$ mkdir /root/mysql-5.1-data
$ cp -R /var/lib/mysql/ /root/mysql-5.1-data
Backup the data as SQL dump
Backup the mysql database separately and not with all the other databases, because we are going to need it before we restore all the databases.
$ mkdir /root/mysql-5.1-dump
$ mysqldump -u user_name -p --databases mysql > /root/mysql-5.1-dump/mysql.sql
$ mysqldump -u user_name -p --databases db_name > /root/mysql-5.1-dump/db_name.sql
Backups are essential, I had a copy of phpmyadmin installed, so I took advantage of this and exported all of the databases into a gzip file and saved it to my desktop.
Secondary MySQL Server for Production sites
For my situation I’m working on a clients server that contains both, the development site as well as the production site. I used our 5Twenty Studios server and setup a database for the production website. I then redirected the production site to this new database while I upgrade the server.
As a test I shut down mysql on the server and confirmed that the dev site was offline and that the production site was alive and well.
$ /etc/init.d/mysql stop
Remove the older version of MySQL
Now is the time to remove the older version of MySQL, in this case I assume the older version to be MySQL 5.1
$ apt-get remove mysql-server-5.1
$ apt-get autoremove
$ apt-get remove mysql-client
$ apt-get autoremove
Remove the MySQL files from the older version
$ rm -R /var/lib/mysql
$ rm -R /etc/mysql
$ rm -R /usr/lib/mysql
I had to run through this installation process multiple times over the course of three days, so I used this next command to search for all of the mysql instances on my server and removed them. I wanted to make sure that I was working with a blank slate.
$ find / | grep mysql
Alright, now that you’re making sure that nothing is lost in this process, lets head to step two: Installing MySQL 5.5.11