MySQL is the world's most popular open-source relational database.
Install
apt update
apt install mysql-server -ySecure Installation
mysql_secure_installationFollow the prompts to set a root password, remove anonymous users, disable remote root login, and remove the test database.
Connect
mysql -u root -pCreate a Database and User
CREATE DATABASE myapp;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'SecurePassword123!';
GRANT ALL PRIVILEGES ON myapp.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;Key Files
- Config:
/etc/mysql/mysql.conf.d/mysqld.cnf - Data:
/var/lib/mysql/ - Logs:
/var/log/mysql/