openSUSE

How To Install MariaDB on openSUSE

Install MariaDB on openSUSE

In this tutorial, we will show you how to install MariaDB on openSUSE. MariaDB is a widely acclaimed open-source relational database management system (RDBMS) that is a fork of MySQL. It is known for its robustness, scalability, and compatibility with MySQL. This makes it a preferred choice for developers and database administrators who are looking for a reliable SQL server solution.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MariaDB database on openSUSE.

Prerequisites

  • A server running one of the following operating systems: openSUSE.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. openSUSE provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection to download MariaDB and its dependencies.
  • You need access to a user account with sudo privileges. The sudo command allows you to run programs with the security privileges of another user (by default, the superuser). This is necessary for installing packages and making system-wide changes.

Install MariaDB on openSUSE

Step 1. First and foremost, it‘s crucial to ensure your system packages are up-to-date. This step helps to avoid potential conflicts between software dependencies. Open the terminal, which is typically accessible via a shortcut or the applications menu in your Linux distribution. Once the terminal is open, run the following commands to update all system packages:

sudo zypper refresh
sudo zypper update

Step 2. Installing MariaDB on openSUSE.

Using the official MariaDB repository ensures you receive the latest updates and security patches directly from the source. Add the repository with the following commands:

sudo zypper addrepo --gpgcheck-allow-unsigned --refresh https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo zypper --gpg-auto-import-keys refresh

With the repository in place, you can now install the MariaDB server package:

sudo zypper install MariaDB-server

This command installs the MariaDB server and all necessary dependencies. The installation process may take a few minutes, depending on your internet connection speed.

After installation, start the MariaDB service and enable it to launch on boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3. Secure MariaDB Installation.

MariaDB includes a script called mysql_secure_installation that helps secure your database server. Running this script is highly recommended. It allows you to set a root password, remove anonymous users, disable remote root login, and remove the test database. To run the script, use the following command:

mysql_secure_installation

You will be prompted to set a root password and confirm several security-related operations. It’s recommended to answer ‘yes’ to all prompts.

Step 4. Testing the Installation.

To verify that MariaDB is working correctly, you can log in to the MariaDB console with the following command:

mysql -u root -p

You will be prompted to enter the root password you set during the secure installation process. If everything is working correctly, you should see the MariaDB prompt. To exit the database prompt, type exit and press enter.

Step 5. Basic MariaDB Commands.

Now that MariaDB is installed and secured, let’s go over some basic commands. To create a new database, use the following command, replacing database_name with the name of your database:

CREATE DATABASE database_name;

To create a new user and grant them all privileges on a database, use the following commands, replacing username, password, and database_name with your own values:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'your-strong-password';
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';

These are just a few examples of the many operations you can perform with MariaDB. For more detailed information, refer to the official MariaDB documentation.

Congratulations! You have successfully installed MariaDB. Thanks for using this tutorial for installing the MariaDB database on your openSUSE system. For additional or useful information, we recommend you check the official MariaDB website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button