MySQL remains one of the most popular open-source relational databases in 2026. This tutorial walks you through installing MySQL on Ubuntu 22.04 LTS and performing basic security configuration.
Step 1: Update Package Index
sudo apt update
Step 2: Install MySQL Server
sudo apt install mysql-server -y
Step 3: Check MySQL Service Status
sudo systemctl status mysql
Step 4: Run Security Script
sudo mysql_secure_installation
Follow the prompts to set root password, remove anonymous users, disable remote root login, and remove test databases.
Step 5: Test MySQL Connection
sudo mysql -u root -p
Enter the password you just set. You should see the MySQL prompt.
Step 1: Update Package Index
sudo apt update
Step 2: Install MySQL Server
sudo apt install mysql-server -y
Step 3: Check MySQL Service Status
sudo systemctl status mysql
Step 4: Run Security Script
sudo mysql_secure_installation
Follow the prompts to set root password, remove anonymous users, disable remote root login, and remove test databases.
Step 5: Test MySQL Connection
sudo mysql -u root -p
Enter the password you just set. You should see the MySQL prompt.
