This blog will demonstrate the method to install, use, and uninstall MariaDB on Ubuntu 22.04. Let’s get started!
How to install MariaDB on Ubuntu 22.04
For the purpose of installing MariaDB on Ubuntu 22.04, follow the given instructions.
Step 1: Update system packages
First of all, update the system packages by hitting “CTRL+ALT+T” and running provided command:
All packages are updated:
Step 2: Install packages
Execute the below-given command to install packages essential for MariaDB installation:
Now move to the next step.
Step 3: Install MariaDB
To install MariaDB on Ubuntu 22.04, utilize the given command in the terminal:
MariaDB installation will take a few minutes to complete:
Step 4: Check MariaDB version
Now, check the version of the installed MariaDB:
The given output indicates that we have successfully installed MariaDB version “15.1” on our Ubuntu 22.04:
Step 5: Check MariaDB status
Then, check if MariaDB is active on your Ubuntu 22.04 system:
As you can see, MariaDB is currently active and running on our system:
Step 6: Execute MariaDB script
In this step, we will install the security script with the MariaDB installation to protect our database from hacker and any kind of intrusion:
You will be then asked to configure the following settings:
- Password for root user
- unix-socket authentication
- Test database and its access
- Reloading privileges
Type out “Y” for “yes” and “n” for refusing the given option:
Step 7: Log in to MariaDB
Write out the provided command in terminal for logging in to MariaDB account:
Step 8: Flush privileges
Before moving ahead firstly, it is required to flush all privileges:
Step 9: Create database
Then create the Maria database by utilizing the given command:
In our case, We have named our database as “testdb”:
Step 10: View Database
To view the list of newly created and existing Maria Databases, execute the provided command:
Step 11: Create MariaDB user
In the next step, specify the username and password in the below-given command for creating a MariaDB user:
Step 12: Grant Privileges
Then grant all privileges to the created MariaDB “linuxhint” user:
Step 13: Exit MariaDB
Lastly, type “quit” to logout from the active MariaDB shell:
Want to upgrade MariaDB? Have a look at the following section.
How to upgrade MariaDB on Ubuntu 22.04
In order to upgrade the version of installed MariaDB, write out the provided command in the terminal:
Now, let’s check the procedure for uninstalling MariaDB from Ubuntu 22.04.
How to uninstall MariaDB on Ubuntu 22.04
To uninstall MariaDB, type the provided command in the Ubuntu 22.04 terminal:
Hit the “yes” option to make sure that you want to delete all MariaDB databases:
The given output indicates that MariaDB is successfully removed from our Ubuntu 22.04 system:
We have compiled the easiest method to install, use, and uninstall MariaDB on Ubuntu 22.04 system.
Now that MariaDB is installed, please read the MariaDB Tutorial.
To install MariaDB on Ubuntu 22.04, firstly, update the system packages. After that, install the required packages and run the “$ sudo apt install mariadb-server mariadb-client” command. Next, execute the security script. Then log in to MariaDB with “$ sudo mariadb” command and create databases, and new users, assign privileges, and use them. This blog demonstrated the method to install, use, and uninstall MariaDB on Ubuntu 22.04.