How To Install MySQL 5.6 On Debian

Valic —  December 31, 2012 — 2 Comments

MySQL 5.6 will add more performance improvements over MySQL 5.5. MySQL 5.6 is not stable yet but I will show you how to install MySQL 5.6.8rc on Debian if you want to test it.

Step1. Add a group and an user for MySQL called mysql:

root@testing:~# groupadd mysql
root@testing:~# useradd -r -g mysql mysql

Step2. Install the libaio1 library package. This is used by MySQL:

root@testing:~# apt-get install libaio1

Step3. Download MySQL 5.6.8rc version in /usr/local location:

root@testing:~# cd /usr/local
root@testing:/usr/local# wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
2012-12-30 16:11:31 (5.10 MB/s) - `mysql-5.6.8-rc-linux2.6-x86_64.tar.gz' saved [293210851/293210851]

Step4. Unpack the MySQL archive and rename it to mysql:

root@testing:/usr/local# tar xvfz mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
root@testing:/usr/local# mv mysql-5.6.8-rc-linux2.6-x86_64 mysql
root@testing:/usr/local# cd mysql

Step5. Change the owner to mysql:

root@testing:/usr/local/mysql# chown -R mysql .
root@testing:/usr/local/mysql# chgrp -R mysql .

Step6. Create the necessary mysql database:

root@testing:/usr/local/mysql# scripts/mysql_install_db --user=mysql

Step7. Change ownerships again to root and to mysql for data directory.

root@testing:/usr/local/mysql# chown -R root .
root@testing:/usr/local/mysql# chown -R mysql data

Step8. Copy the init script for the mysql to /etc/init.d/ location:

root@testing:/usr/local/mysql# cp support-files/mysql.server /etc/init.d/mysql.server

Optionally you can rename the file from mysql.server to mysql

Step9. Start MySQL 5.6 as follows:

root@testing:/usr/local/mysql# /etc/init.d/mysql.server start
Starting MySQL..

Step10. Make MySQL start automatically at boot time

root@testing:/usr/local/mysql# update-rc.d mysql.server defaults
update-rc.d: using dependency based boot sequencing

Step11. At this time the MySQL commands are not in the PATH and that means when we want to call one of theese commands we need to use relative path. We need to create a symlink to avoid that.

root@testing:/usr/local/mysql# ln -s /usr/local/mysql/bin/* /usr/local/bin/

Step12. Set a root password for MySQL the mysql_secure_installation:

root@testing:/usr/local/mysql# mysql_secure_installation

And follow the instructions. (mostly just press enter)

Step13. Check if MySQL is running and check version:

root@testing:/usr/local/mysql# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0* LISTEN 361/sshd
tcp6 0 0 :::3306 :::* LISTEN 592/mysqld
tcp6 0 0 :::22 :::* LISTEN 361/sshd

root@testing:/usr/local/mysql# mysql -V
mysql Ver 14.14 Distrib 5.6.8-rc, for linux2.6 (x86_64) using EditLine wrapper

NOTE: MySQL is using the my.cnf file located in /usr/local/mysql.


Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to How To Install MySQL 5.6 On Debian

  1. Thank a lot for this tutorial. I was able to upgrade mine from original default 5.5 in ubuntu server to 5.6. But in phpinfo(), it shows Mysql Client API version: 5.5.29. Where should I find a new extension for mysql 5.6 to take advantage of new mysql 5.6 features ?

  2. I think you dindn’t install mysql 5.6. Make sure that you are downliading the correct version (Step3 from tutorial)

Leave a Reply


Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>