Databases are essential for dynamic websites and applications. Debian supports both MySQL and MariaDB, two of the most popular relational database systems. This guide explains how to install and secure them on HostPalace servers.
sudo apt update && sudo apt upgrade -y
sudo apt install mysql-server -y
Enable MySQL at boot:
sudo systemctl enable mysql
Check status:
sudo systemctl status mysql
sudo apt install mariadb-server -y
Enable MariaDB at boot:
sudo systemctl enable mariadb
Check status:
sudo systemctl status mariadb
Run the security script:
sudo mysql_secure_installation
This allows you to:
mysql -u root -p
Enter the root password to access the MySQL/MariaDB shell.
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
Note: HostPalace Debian servers are optimized for MySQL and MariaDB, ensuring secure and reliable database hosting for client applications.