How to Install MariaDB in Ubuntu 22.04?
Greetings, Developers!
In this guide, you will discover the steps for installing MariaDB on Ubuntu 22.04. I'll also demonstrate how to install the MariaDB client on Ubuntu. Throughout this tutorial, you'll find straightforward instructions on installing MariaDB on Ubuntu 22.10. Furthermore, I will provide you with a concise example of installing MariaDB version 10.5 specifically tailored for Ubuntu 22.04.
To install MariaDB on Ubuntu, you can follow these step-by-step instructions:
Step 1: Update the Package Repository
Before installing any software, it's a good practice to update the package repository to ensure you are installing the latest available packages. Open your terminal and run the following command:
sudo apt update
You may be prompted to enter your password to confirm that you have administrative privileges.
Step 2: Install MariaDB
Once the package repository is up to date, you can proceed to install MariaDB. Use the following command:
sudo apt install mariadb-server
During the installation, you will be asked to confirm whether you want to proceed. Type 'Y' and press Enter.
Step 3: Secure MariaDB Installation
MariaDB comes with a script that helps you secure your installation. Run the following command:
sudo mysql_secure_installation
This script will guide you through a series of security-related questions. Here's how you can answer them:
- Enter current password for root (enter for none): Press Enter because you haven't set a root password yet.
- Set root password? [Y/n]: Type 'Y' and set a strong root password.
- Remove anonymous users? [Y/n]: Type 'Y' to remove anonymous users.
- Disallow root login remotely? [Y/n]: Type 'Y' to disallow root login remotely for security.
- Remove test database and access to it? [Y/n]: Type 'Y' to remove the test database.
- Reload privilege tables now? [Y/n]: Type 'Y' to reload the privileges.
Your MariaDB installation is now secure.
Step 4: Start and Enable MariaDB
To start MariaDB and enable it to start automatically at boot, use the following commands:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Step 5: Verify MariaDB Installation
You can check if MariaDB is running properly by running:
sudo systemctl status mariadb
If it's active and running, you will see a message indicating that it's active.
Step 6: Log into MariaDB
To log in to MariaDB as the root user, you can use the following command and enter the root password you set during the installation:
sudo mysql -u root -p
You are now logged into the MariaDB database server.
That's it! You've successfully installed MariaDB on your Ubuntu system and secured it. You can now use MariaDB to create databases, tables, and manage your data.
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to install Ruby on Rails with RVM on Ubuntu 22.04 Terminal?
- How to Install FFmpeg in Ubuntu 22.04?
- How to Install Apache Maven on Ubuntu 22.04 Terminal?
- How to Install Let's Encrypt SSL Certificate on Ubuntu 22.04?
- How to Install MySQL 8 in Ubuntu 22.04 Terminal?
- How to Enable ufw Firewall in Ubuntu 22.04?
- How to Disable ufw Firewall in Ubuntu 22.04?
- How to Delete File in Ubuntu 22.04?
- How to Change Root Password in Ubuntu 22.04?
- How to Zip & Unzip Files in Ubuntu 22.04 Terminal?
- How to Install Django Web Framework in Ubuntu 22.04?
- How to Install MongoDB in Ubuntu 22.04?