MySQL is a prevalent 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 several 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 of installing MySQL in Ubuntu 14.04.
How to install MySQL in Ubuntu 14.04
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 log in 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 MySQL version for your particular distro, you should first update your server's package index and then perform the installation using apt-get.
apt-get install mysql-server
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
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.
To install MySQL version 5.7, you'll need to add the MySQL repository, update the server's package index, and finally install MySQL 5.7. This process can be accomplished by using the following sequence of commands: