This tutorial will guide you with the installation of the MariaDB server on the Ubuntu 22.04 Linux system.
1. Configure Repository
The MariaDB packages are available in default Ubuntu repositories. Also, MariaDB provides an official repository to install the latest version on Ubuntu systems. In order to configure MariaDB Apt repository, open a terminal with a sudo privileged account and run the following commands. The above commands will create a repository file under /etc/apt/sources.list.d directory.
2. Installing MariaDB on Ubuntu
Next, execute the following commands to install the MariaDB server and client on your Ubuntu system. Press ‘y’ and hit Enter, when prompted for the confirmation. Once the installation is finished, execute the mysql_secure_installation script to secure MariaDB server and set a password for root account. Follow the on-screen instructions to complete the security wizard.
3. Manage MariaDB Service
MariaDB creates a systemd configuration file to manage its service. Use the following commands to stop, start, or restart the MariaDB service. To view the current status of MariaDB service, type:
4. Connect to MariaDB
You can get a MariaDB shell to create users, databases, and other related activities. To connect shell, type: Type the MariaDB root user password you set with the mysql_secure_installation command.
Conclusion
This tutorial helped you to install and configure the MariaDB server on the Ubuntu system. Now you can create databases for your awesome applications. We strongly recommended creating a separate user account for the databases.