How to Configure MariaDB After Installing on Debian 12
If you’ve just completed the steps to install MariaDB on Debian 12, congratulations! But installation is only the first step. To ensure your database system is secure and fully functional, post-installation configuration is essential. This forum post covers the key configuration steps you should take right after setup.
First, make sure the MariaDB service is running and enabled on boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Next, run the built-in security script to protect your MariaDB instance:
sudo mysql_secure_installation
This script allows you to:
Set a root password
Remove anonymous users
Disable remote root login
Delete the test database
Reload privilege tables
These steps significantly improve your server’s security posture.
After securing your installation, log into the MariaDB shell:
sudo mariadb
Here, you can create a new database and user:
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
This keeps your applications organized and prevents root access exposure.
For advanced configurations like setting bind-address or enabling remote connections, edit the MariaDB config file:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Finally, don’t forget to restart MariaDB after making changes:
sudo systemctl restart mariadb
For the full installation steps and additional insights, check out this detailed guide on how to install MariaDB on Debian 12.
Let us know below if you need help with custom configurations or remote access setup!
