How to Install MySQL in Ubuntu 14.04

MySQL is a very popular open source database management system that you’ll typically find in a Linux server environment as part of a LAMP stack. MySQL is used by a number of large companies across the internet such as Facebook and YouTube to store various bits of pertinent data. MySQL can also be used when working with content management systems such as Joomla or WordPress which you can use to create a stylish website. This article will walk you through the process to install MySQL in Ubuntu 14.04.

 

How to install MySQL in Ubuntu 14.04

There are a few things to consider when installing MySQL in Ubuntu 14.04, primarily what version of MySQL you’d like to use. You can either install the version included by default in the APT repository (5.5 or 5.6), or you can manually add MySQL’s repository directly and install the latest version. This decision is solely up to you and your specific needs/requirements, however if you’re not certain you can always use the version available through the APT repository, as this will be the most recent version available for your distro. Before we get started you’ll need to have access to your server and you’ll need to login via SSH as the root  user. If you’re not certain how to access your server using SSH, please refer to the following article: Connecting to Your Server via SSH.

 

To install the most recent version of MySQL for your particular distro, you should first update your server’s package index, then perform the installation using apt-get .

 

During the installation process, you will be asked to enter your MySQL password. 

To finalize the installation you’ll need to run the security script that is included with MySQL. This script will allow you to change some of the default options which are typically less secure:

 

MySQL 5.5 or 5.6

If you’d like to install MySQL version 5.5 or 5.6 specifically, you’d issue either of the following commands:

 

apt-get install mysql-server-5.5

 

Or

 

apt-get install mysql-server-5.6

 

Regardless of which version you decide to install, you’ll be prompted to create the MySQL root password during the installation. Please be sure to keep this password handy, as you may need it a bit later.

 

MySQL 5.7

To install MySQL version 5.7, you’ll need to add the MySQL repository, update the servers package index and then finally install MySQL 5.7. This process can be accomplished by using the following sequence of commands:

 

 

To finalize the installation you’ll need to run the security script that is included with MySQL. This script will allow you to change some of the default options which are typically less secure:

 

 

Last but not least, if you’re using a version of MySQL less than 5.7.6, you’ll need to initialize the data directory by using the following command:

 

 

If everything went successfully, the MySQL version of your choice should now be installed!


Share:

Leave a Reply