To install MariaDB on Debian 12, follow these steps:
1. Update Package Index
Start by updating the package index to ensure your system has the latest information on available packages.
1 |
sudo apt update |
2. Install MariaDB Server
Use the following command to install the MariaDB server and client:
1 |
sudo apt install mariadb-server mariadb-client -y |
3. Start and Enable MariaDB Service
Once installed, start the MariaDB service and enable it to start on boot.
1 2 |
sudo systemctl start mariadb sudo systemctl enable mariadb |
4. Secure the Installation
To improve the security of your MariaDB server, run the security script:
1 |
sudo mysql_secure_installation |
During this process, you’ll be asked to:
- Set a root password.
- Remove anonymous users.
- Disallow root login remotely.
- Remove test databases.
- Reload privilege tables.
Answer each prompt based on your preferences for security.
5. Test the Installation
To verify that MariaDB is installed and running, log in to the MariaDB shell:
1 |
sudo mysql -u root -p |
You should see the MariaDB shell if the installation was successful.
6. (Optional) Configure MariaDB
You can edit the MariaDB configuration file for additional settings if needed. The main configuration file is located at:
1 |
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf |
After making changes, restart MariaDB to apply them:
1 |
sudo systemctl restart mariadb |
Your MariaDB server should now be up and running on Debian 12. Let me know if you need help with specific configurations!