How to install MySQL server on Ubuntu 16.04

For years on MySQL is one of the most popular database server. In this short article we’ll help setup your MySQL server on Ubuntu Server 16.04.

Installation is pretty simple. Just update your ‘apt’ package lists and install the ‘mysql-server’ package:

apt update
apt install mysql-server

The only dialog during the installation will ask you to set the password for the ‘root’ user:

Pay attention and remember the password. You’ll need it later to access your database!

Once the installation is complete you can connect to your new database server using the ‘mysql’ command line interface:

mysql -u root -p

Which will bring you in the ‘mysql’ prompt:


That’s all you need to setup a MySQL database server.