sudo apt updatesudo apt install mysql-server-8.0- Check status: sudo systemctl status mysql.service
- Start service: sudo systemctl start mysql.service
- Enable service: sudo systemctl enable mysql.service
sudo find / -type f -name "mysqld.cnf"sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
# Add or modify:
[mysqld]
default_authentication_plugin=caching_sha2_passwordsudo mysql_secure_installationsudo systemctl restart mysql.serviceCREATE USER 'primary_user'@'localhost' IDENTIFIED BY 'YourPassword123!';
CREATE USER 'secondary_user'@'localhost' IDENTIFIED BY 'YourPassword321!';# All privileges:
GRANT ALL PRIVILEGES ON *.* TO 'primary_user'@'localhost';
# Specific privileges:
GRANT INSERT, SELECT, UPDATE, DELETE ON *.* TO 'secondary_user'@'localhost';FLUSH PRIVILEGES;exitNote:
This content is summarized based on instructions from the article: How to Install MySQL on Ubuntu 24.04