If you are on the lookout for an effective and powerful database server that can handle your growing data needs, MariaDB stands out as a top-tier open-source choice. Originating from MySQL as a community-driven fork, MariaDB delivers exceptional levels of performance, stability, and reliability, making it a go-to solution for many organizations and developers alike. In this extensive guide, we aim to provide you with a detailed, step-by-step walkthrough of how to install MariaDB on your openSUSE system, setting the foundation for your future database management tasks.
How to Install MariaDB on openSUSE
Table of Contents
- Prerequisites
- Installing MariaDB
- Configuring MariaDB
- Securing MariaDB
- Managing MariaDB
- Conclusion
Prerequisites
Before starting, make sure your openSUSE system is up to date. If you’re new to openSUSE, check out our guides on how to install Python and how to install NGINX for a solid foundation.
Installing MariaDB
To begin, open a terminal and run the following command to install the MariaDB package:
sudo zypper install mariadb mariadb-tools
Once the installation is complete, enable and start the MariaDB service:
sudo systemctl enable mariadb
sudo systemctl start mariadb
Congratulations! MariaDB is now installed on your openSUSE system.
Configuring MariaDB
MariaDB uses a configuration file located at /etc/my.cnf
. You can customize this file to suit your needs. For instance, you might want to adjust the max_connections
or innodb_buffer_pool_size
settings. If you’re unsure about any specific configuration options, consult the official MariaDB documentation.
Additionally, you may want to configure your MariaDB server to use a different data directory or listen on a specific IP address. To do this, edit the /etc/my.cnf
file and add or modify the following settings under the [mysqld]
section:
datadir = /path/to/new/datadir
bind-address = IP_ADDRESS
After making changes to the configuration file, restart the MariaDB service:
sudo systemctl restart mariadb
Securing MariaDB
It’s important to secure your MariaDB installation to protect your data from unauthorized access. Run the mysql_secure_installation
script to achieve this:
sudo mysql_secure_installation
The script will prompt you to set a root password, remove anonymous users, disallow remote root login, and remove the test database. It’s recommended to follow the script’s suggestions for a more secure installation.
Managing MariaDB
To interact with your MariaDB server, use the mysql
command-line client. Here are some basic commands:
- Log in to MariaDB:
mysql -u root -p
To display a list of all existing databases within your MariaDB server, simply execute the following command while logged into the MariaDB command-line client. This will provide you with an overview of the databases currently available, allowing you to manage and interact with them accordingly:
SHOW DATABASES;
Create a new database:
CREATE DATABASE database_name;
Delete a database:
DROP DATABASE database_name;
Create a new user:
CREATE USER 'user_name'@'localhos
IDENTIFIED BY 'password';
When managing your MariaDB server, you may need to grant specific privileges to a user, allowing them to perform certain actions or access particular databases. Assigning the appropriate privileges ensures that users have the necessary permissions to carry out their tasks, while also maintaining a secure and well-organized database environment. To grant privileges to a user, simply execute the following command, which provides the designated user with the required access rights to perform operations on the specified database:
GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost';
Reload privileges:
FLUSH PRIVILEGES;
Exit the MariaDB shell:
EXIT;
For more in-depth instructions on managing your MariaDB installation, you can refer to the official MariaDB documentation
Conclusion
Congratulations! You have successfully installed, configured, and secured MariaDB on your openSUSE system. Now you can use it as a powerful database server for your applications. If you’re looking to set up additional services on your openSUSE system, consider checking out our guides on how to install Apache or how to set up a home server with Ubuntu