How to Install Mysql on Ubuntu 17

Try it in our public cloud & Get $50 Credit

How to Install MySQL on Ubuntu 17

MySQL is a database management system that runs on multiple platforms, including Windows, Unix-based, and Linux platforms. MySQL is often used for web-based applications, online publishing, and some web development platforms.

Ubuntu is an open source operating system based on Linux and is a popular operating system choice for personal computers and mobile devices. Ubuntu is also a popular choice for running physical or virtual servers and is currently one of the most popular choices for running cloud hosting environments.

MySQL Logo

Getting Started

In order to follow this guide you will need to have the following in place:
• One node (Cloud Server or Dedicated Server) that has Ubuntu 14.04 LTS installed.
• SSH Root Access to your server
Before you can begin installing MySQL on Ubuntu 17.04, you need to have one node, a cloud server or a dedicated server, with Ubuntu 17.04 currently installed.

Additionally, Secure Shell (SSH) root access to your server running Ubuntu 17.04 is recommended. SSH, if you’re unaware, is a network protocol used when network services are being executed over an unsecured network; SSH allows for secure execution.


Installing MySQL

Now that your node is established, Ubuntu is installed, and you have SSH root access to your server, you want to verify that your server is up to date and current repositories are installed:
apt-get update && apt-get upgrade -y

Once you have confirmed the server is currently running the most recent version, you can begin the process to install MySQL. While the primary installation package is necessary, other packages may be optional and should be installed if necessary:

apt-get install mysql-server mysql-client -y

While you are installing MySQL packages, you will be prompted to select a new root password. That password will then be used to sign in to your MySQL as a super user. It’s recommended that you select a strong password, write it down if necessary, and keep it secured.

After the installation of MySQL is complete, you may need to secure your new MySQL. There is a script you may utilize from your command line to secure MySQL:

During this process, the script will prompt you for answers to several questions. You will not need to change your root password, but you may want to remove anonymous users and disable remote login, depending on your needs. You may follow the answers indicated below for an easy setup:
Enter password for user root: ENTER ROOT PASSWORD
Press y|Y for Yes, any other key for No: n
Change the password for root ? n
Remove anonymous users? y
Disallow root login remotely? y
Remove test database and access to it? y
Reload privilege tables now? y

Finally, you’ve completed the setup of your MySQL on Ubuntu 17.04. You are now able to log in using the root account and the password you setup earlier, entering them into the command line. Use the following command to log in:
mysql -u root -p

After entering the root username and password you created, you will be signed into the MySQL command line client.

Congratulations! Enjoy your new MySQL setup on your server running Ubuntu 17.04.


You’ve successfully completed the steps necessary to install MySQL on either a cloud or dedicated server that’s running Ubuntu 17.04. Your MySQL is ready to be placed into production. If you found this setup guide helpful, please share it with others that are looking to setup their own MySQL.