How to Install MariaDB on Debian 12

To install MariaDB on Debian 12, you can follow these steps:

Step 1 : Update the package lists:

Step 2 : Install the MariaDB server package:

Step 3 : Start the MariaDB service:

Step 4 : Enable MariaDB to start automatically on system boot:

Step 5 : Run the mysql_secure_installation script to secure your MariaDB installation:

- Enter the current password for the MySQL root user.

- Switch to unix_socket authentication (Y)

- Change the root password? (Y)

- Remove anonymous users (Y)

- Disallow root login remotely (Y)

- Remove test database and access to it (Y)

- Reload privilege tables now? (Y)

Step 6 : Log in to the MySQL server as the root user:

Step 7 : Create a new MySQL user. In this example, we'll create a user named "admin" with a password. Replace your_password with the desired password for the user:

Step 8 : Grant all privileges to the user. This will provide administrative privileges to the user:

Step 9 : To apply the changes and refresh the MySQL privileges, run the following command:

Step 10 : Exit the MySQL prompt:

Now you have successfully installed, secured, created a MySQL user named "admin," and granted privileges on Debian 12. You can use the "admin" user to manage the MySQL server.

Congratulations! You have successfully installed and secured MySQL on Debian 12.