How to Install MySQL on Ubuntu 14.04

Try it in our public cloud & Get $50 Credit
CLAIM NOW

MySQL has been around for quite a while. It’s a popular relational database management system that exists since 1995. The following article will guide you on how to install MySQL on Ubuntu 14.04 LTS.

Getting Started

To complete this guide, you will need the following:

• 1 Node (Cloud Server or Dedicated Servers) with Ubuntu 14.04 LTS installed

Install MySQL

To install MySQL, first set apt-get to query the most up to date list of repositories by running an apt-get update.

apt-get update

We will install 3 packages: mysql-server, libmysqlclient-dev, python-mysqldb. mysql-server is the main MySQL package, libmysqlclient-dev is the MySQL development library and python-mysqldb is the python interface for MySQL. While the mysql-server package is essential, the others are optional and listed here as they may be useful for most usage. The command is as follow:

apt-get install mysql-server libmysqlclient-dev python-mysqldb

During package installation, you will have a prompt asking you for a new root password. You will need that password when login in to MySQL as the super user. We recommend that you choose a strong password and you keep it in a safe place.

Once the installation process is finished, you may want to secure your MySQL, especially when used in production. To do that, there is a script called mysql_secure_installation which you can call from the command line, no other utilities necessary.

mysql_secure_installation

The script will ask several questions. The root password would not need to be changed. However, it is recommended to remove anonymous users, disallow remote login if you are not going to query the server remotely, remove the test database and reload the privilege on tables.

Once that’s finished, you can now login to mysql in command line. To do so, use the following command:

mysql –u root –p

Enter your password and you will now be logged into the MySQL command line client.

Conclusion

Your MySQL server is now setup and ready to be used in production. If this guide was helpful to you, kindly share it with others who may also be interested.