[2 min installs] MySQL on Ubuntu

Better Stack Team
Updated on August 30, 2022

Here is how to install MySQL on Ubuntu 20.04 in under 2 minutes:

Step 1 - Update package list

First, update the package index on your server if you’ve not done so recently:

 
sudo apt update

apt update downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs.

Step 2 - Install the MySQL package

Now, install the mysql-server package:

 
sudo apt install mysql-server

Step 3 (optional) - Make sure the server is running

To make sure that the MySQL server is running in the background, execute the following command:

 
sudo systemctl start mysql.service

That’s it

You have successfully installed MySQL on your Ubuntu system. Now you may want to secure it by running the mysql_secure_installation script that comes with the installation package. This script will guide you through setting-up and securing your MySQL server.

Check Uptime, Ping, Ports, SSL and more.
Get Slack, SMS and phone incident alerts.
Easy on-call duty scheduling.
Create free status page on your domain.
Got an article suggestion? Let us know
Next article
[2 min installs] PostgreSQL on Ubuntu
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.