How to install MySQL on Ubuntu

First of all, make sure your package management tools are up-to-date. Also make sure you install all the latest software available.

sudo apt-get update

sudo apt-get dist-upgrade

Install the MySQL server and client packages:

sudo apt-get install mysql-server mysql-client

The apt-get command will also install the mysql-client package which is necessary to login to mysql from the server itself.

During the installation, MySQL will ask you to set a root password.

You can now access your MySQL server like this:

mysql -u root -p

mysql>

Have fun using MySQL Server 🙂

What is mysql server and mysql client

The mysql server package will install the mysql database server which you can interact with using a mysql client. You can use the mysql client to send commands to any mysql server; on a remote computer or your own.

The mysql server is used to persist the data and provide a query interface for it (SQL). The mysql clients purpose is to allow you to use that query interface.