To install and secure MySQL on your VPS, do the following:
(for Ubuntu/Debian/CentOS)
Install MySQL with sudo apt install mysql-server (Ubuntu/Debian) or yum install mariadb-server (CentOS), and then start the service with systemctl start mysql or systemctl start mariadb.
After that, run the secure script: mysql_secure_installation
You can then create a user and database:
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
We recommend configuring remote access and setting up a firewall to limit access.
