How to Install MariaDB on Ubuntu 23.10

To install MariaDB on Ubuntu 23.10, you can follow these steps. MariaDB is a drop-in replacement for MySQL, so if you're familiar with MySQL, the commands are very similar.

Step 1 : Update the Package List:

Make sure your local package list is up-to-date by running:

Step 2 : Install MariaDB:

Use the following command to install the MariaDB server:

Step 3 : Secure the MariaDB Installation

After the installation, secure your MariaDB installation using the mysql_secure_installation script:

Follow the on-screen instructions:

- Enter current password for root (enter for none): Press Enter if you haven't set a root password yet.

- Switch to unix_socket authentication: type "Y" and press Enter:

- Change the root password? [Y/n]: Type "Y" and press Enter to set a secure password for the root user.

- Remove anonymous users? [Y/n]: Type "Y" and press Enter to remove anonymous users.

- Disallow root login remotely? [Y/n]: Type "Y" and press Enter to disallow root login remotely.

- Remove test database and access to it? [Y/n]: Type "Y" and press Enter to remove the test database.

- Reload privilege tables now? [Y/n]: Type "Y" and press Enter to apply the changes.

Step 4 : Start and Enable MariaDB:

After the installation, MariaDB should start automatically. However, if it's not running, you can start it with:

To ensure that MariaDB starts on boot, run:

Step 5 : Check MariaDB Status:

You can check the status of MariaDB with the following command:

This should display information indicating that MariaDB is active and running.

Step 6 : Access MariaDB:

You can access the MariaDB shell by typing:

Step 7 : Create a New User and Grant Privileges

Create a new user and grant all privileges.

This grants the new user all privileges on all databases, allowing them to manage databases, tables, and other objects.

Congratulations! You have successfully installed and secured MariaDB on Ubuntu 23.10.