How To Install MariaDB on Ubuntu 22.04
In this guide, we will walk you through how to install MariaDB on Ubuntu 22.04, providing a robust database solution for your applications and projects.
MariaDB is a robust open-source relational database management system that emerged as a fork of MySQL. Due to its fault tolerance, speed, and scalability, it is commonly used as a replacement for MySQL.
Prerequisites
Launch the Ubuntu 22.04 instance on Neevcloud
Access the server using SSH
Update && Upgrade the system
First, ensure your package list is up to date to avoid any issues with outdated packages

Installing MariaDB
Install the MariaDB package by running the following command
Start and Enable MariaDB
After installation, the MariaDB service starts and enables
Once the MariaDB is installed, start the MariaDB server
Enable it to start when the system rebooted

To check the status
Verify that the database service is active and running. Run the following command

Network status of the MariaDB Service
The network status of the MariaDB service can also be checked by running the ss
command at the terminal prompt

Configure MariaDB
Running the mysql_secure_installation script is advisable to set up your database security levels and access privileges.
To secure MariaDB and access it, we must use the current credentials for login, and password required for the root user. If you recently set up MariaDB and If you haven't created the root password, simply hit the enter key at this point.

Setting the root password or using the unix_socket, You already have your root account protected, so you can safely answer 'n'.

You set the password of your root account and the password should be 8 to 10-bit.

By default, MariaDB installation has an anonymous user, if you want to remove the anonymous user press 'Y' otherwise and click 'n'.
if you disallow root login remotely press Y and otherwise click enter.
By Default. MariaDB comes with a database named 'test' that anyone can access. if you want to remove the test database press 'Y', otherwise 'n'.

All done! If you've completed all of the above steps, your MariaDB installation should now be secure. you can proceed to reopen MariaDB and revert the root user's authentication method to the default, auth_socket. To verify your identity as the main MySQL user with a password, execute this command
After executing the commands, please enter your password

Create a MariaDB User
To create a new MariaDB user, type the following command in the MariaDB console just like
[MariaDB (none)]>
Grant Privileges to MariaDB User
Once you have set up a new user, you can give them the necessary permissions.
Creating a MariaDB Database
To create a database in MariaDB, follow these steps:
User and database permission
Once you have set up a new user and database, you can give them the necessary permissions.
Now, review MariaDB configurations.
Now check the status databases to run these command

Last updated