Step 1: Update/Upgrade Package Repository
sudo apt update
sudo apt upgrade
Step 2: Install MySQL
sudo apt install mysql-server
When asked if you want to continue with the installation, answer Y and hit ENTER.
Note: If you only want to connect to a remote MySQL server instead of hosting a database on your machine, install only the MySQL Client by running:
sudo apt install mysql-client


Step 3: Check if MySQL Service Is Running
sudo systemctl status mysql

Step 4: Log in to MySQL Server
sudo mysql -u root
