How To Install MariaDB on Ubuntu 22.04

Installing MariaDB on Ubuntu 22.04 is a straightforward process. Let's walk through the steps:

  1. Update the package index to ensure you have the latest information about available packages:

    bash sudo apt update

  2. Install MariaDB using the following command:

    bash sudo apt install mariadb-server

  3. After installation, secure your MariaDB installation by running the security script:

    bash sudo mysql_secure_installation

  4. Test your MariaDB installation by running this script:

    bash sudo systemctl status mariadb

  5. If MariaDB isn’t running, you can start it with the command :

    sudo systemctl start mariadb

  6. Connect to the database using the mysqladmin tool:

    sudo mysqladmin version

This script will guide you through several prompts to set up security options for your MariaDB installation. You'll be asked to set a root password, remove anonymous users, and disallow remote root login.

Remember to follow best practices for securing your database!

You now have MariaDB installed and secured on your Ubuntu 22.04 server.