Install MySQL Tutorial on Ubuntu 20.04
prerequisites
Make sure you are logged in as a user with sudo privileges.
Install MySQL on Ubuntu
At the time of writing, the latest version of MySQL available in the Ubuntu repositories is MySQL 8.0. To install it, run the following command:
sudo apt update
sudo apt install mysql-server
After the installation is complete, the MySQL service will start automatically. To verify that the MySQL server is running, enter:
sudo systemctl status mysql
The output should show that the service is enabled and running:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-04-28 20:59:52 UTC; 10min ago
Main PID: 8617 (mysqld)
Status: "Server is operational"
...
secure-mysql
The MySQL installation comes with a script called mysql_secure_installation
, which allows you to easily increase the security of your database server.
Call the script without parameters:
sudo mysql_secure_installation
You will be asked to configureVALIDATE PASSWOR