
MariaDB is an open-source relational database management system used to store and retrieve tabular data using the Structured Query Language (SQL). It supports ACID features to ensure consistency, transaction isolation, and durability. MariaDB is commonly used in web applications, analytics, content management systems, and e-commerce platforms.
This guide will walk you through the steps to install MariaDB on Debian 12, from updating your system and installing the necessary packages to configuring the database server for optimal performance. If you're considering alternative database solutions, you can also check out our article on Install MySQL on Debian 12 for a comparative approach.
sudo privilegesMariaDB is available in the default package repositories on Debian 12. Follow the steps below to install MariaDB on your server.
Update the server package index.
Install the MariaDB database server package.
Test access to the MariaDB console.
Output:
MariaDB uses the mariadb.service or mysqld system service profile to run on the server. Follow the steps below to manage the system service and enable it to start at boot.
Enable MariaDB to start at system boot.
View the MariaDB service status and verify that it's running.
Output:
Start the MariaDB service.
Stop the service to drop all active database connections.
Restart the service.
MariaDB includes insecure defaults such as test databases and user authentication is not active by default. Follow the steps below to enable authentication, remove insecure defaults, and secure the MariaDB server.
Run the MariaDB secure installation script to secure the database server.
Press Enter to proceed with the default root database user password.
Press N and press Enter to enable password authentication when prompted to switch to Unix socket authentication,
Press Y and then Enter to change the default root database user password.
Press Y + Enter to remove anonymous users.
Disable remote access to the root database user.
Remove the default test database.
Reload privileges to save changes.
Restart the MariaDB service to apply your configuration changes.
You can access MariaDB using the mariadb or mysql client utilities. Follow the steps below to access MariaDB and create a sample database on the server.
Log in to MariaDB as root and enter the password you set.
View all databases available on the server.
Output:
Create a new sample database example_vultr.
Create a new sample user test_user with a strong password.
Grant the user full privileges to the database.
Flush the MariaDB privilege tables to apply changes.
Exit the database console.
Access the MariaDB console as the sample user test_user you created earlier.
View all databases available to the user.
Output:
Switch to the example_vultr database.
Create a new sample table with at least 3 columns.
Add the following sample data to the table.
View the table data.
Output:
You have installed MariaDB on a Debian 12 server and secured it to require authentication for all database users. MariaDB is used in real-time applications, data analytics and logging applications as the database backend. For more information and security options, visit the MariaDB documentation.
0 Comments
Be the first to comment and share your perspective with the community.