To install and configure MySQL on Pop!_OS, follow these steps:
Update the System:
sudo apt update && sudo apt upgrade
Install MySQL Server:
sudo apt install mysql-server
Secure the Installation:
During the installation, you'll be prompted to set a root password and answer a few security questions. Follow the on-screen instructions.
Start and Enable MySQL Service:
sudo systemctl start mysql
sudo systemctl enable mysql
Run the Security Script:
This script helps secure the MySQL installation by setting a password for the root user, removing anonymous users, disallowing root login remotely, and removing the test database.
sudo mysql_secure_installation
Login to MySQL:
sudo mysql -u root -p
Create a New Database (Optional):
CREATE DATABASE mydatabase;
Create a New User and Grant Privileges (Optional):
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
Exit MySQL:
EXIT;
To connect to the MySQL server using the newly created user:
mysql -u myuser -p mydatabase
If you're looking for a managed database service, consider using Tencent Cloud's Cloud Database MySQL. It offers automated management, high availability, and scalability, which can simplify database operations and enhance reliability.
By following these steps, you should have MySQL installed and configured on your Pop!_OS system.