One of the daily work of the system administrator is to upgrade the service, add a patch for the service or upgrade some fancy functions. In early 2013, MySQL5.6 was released to provide better performance and scalability. If you are interested in this, you can see how I updated MySQL On Debian and Ubuntu. In this tutorial, I will assume that you have installed MySQL through apt-get. When I wrote this article, most of the Linux distributions were deployed with MySQ
One of the daily work of the system administrator is to upgrade the service, add a patch for the service or upgrade some fancy functions. In early 2013, the latest MySQL 5.6 was released with the goal of providing better performance and scalability. If you are interested in this, you can read the article I wrote.How to upgrade MySQL On Debian and Ubuntu.
In this tutorial, I will assume that you have installed MySQL through apt-get. At the time of writing this article, MySQL 5.5 was deployed on most Linux distributions. Here I will show you how to upgrade from MySQL 5.5 to 5.6.
Step 1: Back up the MySQL configuration file.
$ sudo mkdir /backup$ sudo tar cvfvz /backup/mysql_conf.tgz /etc/mysql
Step 2: export the database to A. SQL file and back up the data under the Data Storage path.
$ sudo sh -c 'mysqldump -u root -p -A --events > /backup/backup_db.sql$ sudo tar cvfvz /backup/mysql_data.tgz /var/lib/mysql
Note: If you provide continuous backup for your online MySQL system, we strongly recommend that you use the single transaction option when performing the preceding steps, or explicitly use the lock (to ensure data consistency-annotation). For more information, see this tutorial.
Step 3: Stop the MySQL Service
$ sudo service mysql stop
Step 4: uninstall the MySQL software package
$ sudo apt-get remove mysql-server mysql-client mysql-common$ sudo apt-get autoremove$ sudo apt-get autoclean
Do not use the purge option when uninstalling with apt-get. This will delete the MySQL configuration file and other data that will be used later.
Step 5: Install the MySQL dependency package (Kernel Asynchronous IO access library). MySQL 5.5 and later versions depend on it.
$ sudo apt-get install libaio1
Step 6: Download the MySQL package of Debian from the official website.
32-bit system:
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-debian6.0-i686.deb
64-bit system:
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-debian6.0-x86_64.deb
Step 7: Install the MySQL software package
$ sudo dpkg -i mysql-5.6.15-debian6.0-*.deb
This package will be installed under the/opt/mysql directory.
Step 8: add the PATH of the MySQL command to the PATH of the system environment variable.
On Debian:
$ sudo sh -c 'echo "PATH=$PATH:/opt/mysql/server-5.6/bin" >> /etc/profile'$ source /etc/profile
On Ubuntu or Linux Mint:
$ sudo sh -c 'echo "PATH=${PATH}:/opt/mysql/server-5.6/bin" >> /etc/environment'$ source /etc/environment
Step 9: Go to the MySQL configuration file and modify the following two lines.
$ sudo vi /etc/mysql/my.cnf
Basedir =/opt/mysql/server-5.6
Lc-messages-dir =/opt/mysql/server-5.6/share