Tutorial for : Installing MySQL 5.6 on Ubuntu 13 x64 Debian Linux
This post should help you to understand how to Install MySQL 5.6 on Ubuntu 13.10 x64 / Debian Linux. As I always say, its very simple process to install it. First head over to MySQL Downloads page and get the 64 bit Debian package for MySQL. Current version out there for general available release is [Note this may change as and when they release minors, so pick what ever is latest from this site at the time of your installation and modify the commands according to your filename]: mysql-5.6.15-debian6.0-x86_64.deb. Make sure you select Debian Linux from the select platform drop down. Make a note of the md5sum to verify that its legit file after we download it. In our case its
409a79231afb46473f8280a108c9dfdd which is right below download button as shown in the picture below.
Once you click download you will be headed to this page and then copy the link on "No thanks, Just start my download":
Now you have the download link in your clipboard/memory, lets go into the terminal of the machine where we will be installing MySQL. Once you are in the terminal window download the package with wget command as shown below:
sudo wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-debian6.0-x86_64.deb
Checksum that is on the website should match the checksum for the file that we calculated. This check is optional but I recommend it. So far we completed downloading the package and verified its the right file. Before we install MySQL we need to install libaio1 package for MySQL to get installed properly, use the following command to get that package installed:
sudo apt-get install libaio1
sudo useradd mysql
sudo dpkg -i mysql-5.6.15-debian6.0-x86_64.deb
We have now successfully installed MySQL Server / Client utilities on this server. We need to do few more steps before we can start using the database engine. First we need to populate the database with default data directories and file. To do that simply run the following command:
We need to change ownership of this installation to mysql. The default MySQL installation path for this version on Ubuntu is /opt. The following command will update the ownership of this MySQL installation directory:
sudo chown -R mysql.mysql /opt/mysql/
Before we start our database server lets add this new installation bin path to system path. This will allow to access mysql commands from any directory with in this server. Edit "/etc/environment" file and add this new path there.
sudo vi /etc/environment
and append this new path at the end in this file.
Now in order to make mysql database server run on system startup or reboots we need to add them to system run levels, so copy the server startup script from our support folder located at /opt/mysql/server-5.6/support-files/mysql.server to /etc/init.d/ folder and update-rc using the following commands:
sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/ sudo update-rc.d mysql.server defaults
sudo /etc/init.d/mysql.server start
We have successfully started our database server now. From here we can either set root password and be done configuring database instance or we can run secure installation to finish our configuration. For production systems I recommend doing secure installation. To do that simply run :
For prod systems create a host specific user with required privileges for your application database. If both web-server and database server are on the same server then I would say don’t allow any remote connections unless you are using an external client to connect to database like Navicat , SQLYog or MySQL Workbench from your home network.
Lets test and see if we can connect to this database server now that we have successfully installed and configured.
mysql -uroot -p
use the password that you have setup when you ran mysql_secure_installation above
CREATE USER 'superadmin'@'%' IDENTIFIED BY 'opensourcedbmsadmin'; GRANT ALL ON *.* TO 'superadmin'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;
That is all there is to installing MySQL 5.6 on Ubuntu. Please leave comments and feedback. Also I highly recommend this post readers to go through the comments as most of the times issues and work arounds to your problems might be in comments.