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:

[email protected]:~# groupadd mysql
[email protected]:~# useradd -r -g mysql mysql

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

[email protected]:~# apt-get install libaio1

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

[email protected]:~# cd /usr/local
[email protected]:/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:

[email protected]:/usr/local# tar xvfz mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
[email protected]:/usr/local# mv mysql-5.6.8-rc-linux2.6-x86_64 mysql
[email protected]:/usr/local# cd mysql
[email protected]:/usr/local/mysql#

Step5. Change the owner to mysql:

[email protected]:/usr/local/mysql# chown -R mysql .
[email protected]:/usr/local/mysql# chgrp -R mysql .

Step6. Create the necessary mysql database:

[email protected]:/usr/local/mysql# scripts/mysql_install_db --user=mysql

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

[email protected]:/usr/local/mysql# chown -R root .
[email protected]:/usr/local/mysql# chown -R mysql data

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

[email protected]:/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:

[email protected]:/usr/local/mysql# /etc/init.d/mysql.server start
Starting MySQL..

Step10. Make MySQL start automatically at boot time

[email protected]:/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.

[email protected]:/usr/local/mysql# ln -s /usr/local/mysql/bin/* /usr/local/bin/

Step12. Set a root password for MySQL the mysql_secure_installation:

[email protected]:/usr/local/mysql# mysql_secure_installation

And follow the instructions. (mostly just press enter)

Step13. Check if MySQL is running and check version:

[email protected]:/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

[email protected]:/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