How To Install MySQL Server Database On OpenSUSE Tumbleweed

In this short article we will learn how to install MySQL Server database on OpenSuse Tumbleweed operating system.
Introduction
In the world of data management, MySQL stands out as one of the most popular and reliable relational database management systems (RDBMS). Developed by Oracle Corporation, MySQL has become a cornerstone for many applications, powering websites, business applications, and various data-driven solutions. This article will delve into the fundamentals of MySQL databases, exploring their features, advantages, and best practices for efficient utilization.
Installing MySQL Server Database on OpenSuse Tumbleweed
To install MySQL on OpenSUSE Tumbleweed, we can use the package manager called Zypper. Here are the steps to install MySQL on OpenSUSE Tumbleweed :
- Update the Package Repository
- Adding MySQL Server Repository
- Install MySQL Server on OpenSuse Tumbleweed
- Starting MySQL Server Service
- Securing MySQL Server
- Accessing MySQL Server
1. Update the OpenSuse Package Repository
Before installing MySQL, it’s a good practice to update your system’s package repository information to ensure you get the latest available packages. Run the following command:
$ sudo zypper refresh
Output :
ramansah@bckinfobckinfo:~> sudo zypper refresh [sudo] password for root: Repository 'Main Repository (NON-OSS)' is up to date. Repository 'Main Repository (OSS)' is up to date. Repository 'Main Update Repository' is up to date. Repository 'openSUSE-20240131-0' is up to date. Repository 'Open H.264 Codec (openSUSE Tumbleweed)' is up to date. All repositories have been refreshed.
2. Adding MySQL Server Repository
At this stage, we will use the latest MySQL database repository to OpenSuse Tumbleweed, for this purpose we will submit the following command line :
$ sudo zypper addrepo https://download.opensuse.org/repositories/server:/database/openSUSE_Tumbleweed/server:database.repo
Output :
ramansah@bckinfobckinfo:~> sudo zypper addrepo https://download.opensuse.org/repositories/server:/database/openSUSE_Tumbleweed/server:database.repo [sudo] password for root: Adding repository 'Databases (openSUSE_Tumbleweed)' ..........................................................................................[done] Repository 'Databases (openSUSE_Tumbleweed)' successfully added URI : https://download.opensuse.org/repositories/server:/database/openSUSE_Tumbleweed/ Enabled : Yes GPG Check : Yes Autorefresh : No Priority : 99 (default priority) Repository priorities are without effect. All enabled repositories share the same priority.
3. Install MySQL Server on OpenSuse Tumbleweed
After all are set, then we will install MySQL database by submitting following command line :
$ sudo zypper refresh $ sudo zypper install mysql-server
Output :
ramansah@bckinfobckinfo:~> sudo zypper refresh Repository 'Main Repository (NON-OSS)' is up to date. Repository 'Main Repository (OSS)' is up to date. Repository 'Main Update Repository' is up to date. Repository 'openSUSE-20240131-0' is up to date. Repository 'Open H.264 Codec (openSUSE Tumbleweed)' is up to date. New repository or package signing key received: Repository: Databases (openSUSE_Tumbleweed) Key Fingerprint: 116E B863 3158 3E47 E63C DF4D 5621 11AC 0590 5EA8 Key Name: server:database OBS Project <server:database@build.opensuse.org> Key Algorithm: DSA 1024 Key Created: Tue 18 Jul 2023 06:50:46 PM WIB Key Expires: Thu 25 Sep 2025 06:50:46 PM WIB Rpm Name: gpg-pubkey-05905ea8-64b67c96 Note: Signing data enables the recipient to verify that no modifications occurred after the data were signed. Accepting data with no, wrong or unknown signature can lead to a corrupted system and in extreme cases even to a system compromise. Note: A GPG pubkey is clearly identified by its fingerprint. Do not rely on the key's name. If you are not sure whether the presented key is authentic, ask the repository provider or check their web site. Many providers maintain a web page showing the fingerprints of the GPG keys they are using. Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): a Retrieving repository 'Databases (openSUSE_Tumbleweed)' metadata .............................................................................[done] Building repository 'Databases (openSUSE_Tumbleweed)' cache ..................................................................................[done] All repositories have been refreshed.
ramansah@bckinfobckinfo:~> sudo zypper install mysql-server Loading repository data... Reading installed packages... 'mysql-server' not found in package names. Trying capabilities. Resolving package dependencies... The following 2 NEW packages are going to be installed: mariadb mariadb-client 2 new packages to install. Overall download size: 19.9 MiB. Already cached: 0 B. After the operation, additional 129.4 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving: mariadb-client-11.2.2-1.18.x86_64 (Databases (openSUSE_Tumbleweed)) (1/2), 1.3 MiB Retrieving: mariadb-client-11.2.2-1.18.x86_64.rpm ..............................................................................[done (654.1 KiB/s)] Retrieving: mariadb-11.2.2-1.18.x86_64 (Databases (openSUSE_Tumbleweed)) (2/2), 18.6 MiB Retrieving: mariadb-11.2.2-1.18.x86_64.rpm .......................................................................................[done (2.7 MiB/s)] Checking for file conflicts: .................................................................................................................[done] /usr/bin/systemd-sysusers --replace=/usr/lib/sysusers.d/mysql-user.conf - (1/2) Installing: mariadb-client-11.2.2-1.18.x86_64 ..........................................................................................[done] (2/2) Installing: mariadb-11.2.2-1.18.x86_64 .................................................................................................[done] Running post-transaction scripts .............................................................................................................[done] Update notifications were received from the following packages: mariadb-11.2.2-1.18.x86_64 (/var/adm/update-messages/mariadb-11.2.2-1.18-something) View the notifications now? [y/n] (n): y (Use arrows or pgUp/pgDown keys to scroll the text by lines or pages.) Message from package mariadb: You have just installed MariaDB server for the first time. You can start it via: systemctl start mariadb or rcmysql start During the first start, empty database will be created for you automatically. PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER! To do so, start the server and run the following commands: '/usr/bin/mysqladmin' -u root password 'new-password' '/usr/bin/mysqladmin' -u root -h <hostname> password 'new-password' Alternatively you can run: '/usr/bin/mysql_secure_installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.

4. Starting MySQL Server Service
After MySQL database installation is completed done, then we will start it service by submitting command line :
$sudo systemctl start mysql $sudo systemctl status mysql $sudo systemctl enable mysql
ramansah@bckinfobckinfo:~> sudo systemctl start mysql ramansah@bckinfobckinfo:~> sudo systemctl status mysql ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; preset: disabled) Active: active (running) since Fri 2024-02-16 22:01:27 WIB; 10s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 27112 ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper install (code=exited, status=0/SUCCESS) Process: 27161 ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper upgrade (code=exited, status=0/SUCCESS) Main PID: 27168 (mysqld) Status: "Taking your SQL requests now..." Tasks: 13 (limit: 2241) CPU: 1.109s CGroup: /system.slice/mariadb.service └─27168 /usr/sbin/mysqld --defaults-file=/etc/my.cnf --user=mysql --socket=/run/mysql/mysql.sock Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: After connecting you can set the password, if you would need to be Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: able to connect as any of these users with a password and without sudo Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: See the MariaDB Knowledgebase at https://mariadb.com/kb Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: Please report any problems at https://mariadb.org/jira Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: The latest information about MariaDB is available at https://mariadb.org/. Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: Consider joining MariaDB's strong and vibrant community: Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27118]: https://mariadb.org/get-involved/ Feb 16 22:01:27 bckinfobckinfo.com systemd[1]: mariadb.service: Got notification message from PID 27174, but reception only permitted for main PID > Feb 16 22:01:27 bckinfobckinfo.com mysql-systemd-helper[27168]: /usr/sbin/mysqld: Deprecated program name. It will be removed in a future release, > Feb 16 22:01:27 bckinfobckinfo.com systemd[1]: Started MariaDB database server.
Then we will make MySQL database service will be available when the system is boot
ramansah@bckinfobckinfo:~> sudo systemctl enable mysql Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
5. Securing MySQL Server
For security reasons, it is usually recommended after installing MySQL database to perform hardening by running the following script :
$sudo mysql_secure_installation
Output :
ramansah@bckinfobckinfo:~> sudo mysql_secure_installation /usr/bin/mysql_secure_installation: Deprecated program name. It will be removed in a future release, use 'mariadb-secure-installation' instead NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] n ... skipping. . . . Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
6. Trying MySQL Server on OpenSuse
At this stage, we have already installed MySQL database on OpenSuse Tumbleweed successfully. The next step is try to use this newly installed database. We will log in and create a new database and table. Here’s the steps :
- Login to MySQL database console as root
- Create new database
- Create new table
We will use root account to log in to MySQL database.
$ sudo su - # mysql -u root -p
Output :
ramansah@bckinfobckinfo:~> sudo su - [sudo] password for root: bckinfobckinfo:~ # mysql -u root -p mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 26 Server version: 11.2.2-MariaDB MariaDB package Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Showing Database list by submitting command line :
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.002 sec)
Create new database by submitting command line :
# CREATE DATABASE dbtestku;
Create new table on database created :
# USE dbtestku; # CREATE TABLE customer ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), email VARCHAR(50) );
Output :
MariaDB [(none)]> USE dbtestku; Database changed MariaDB [dbtestku]> CREATE TABLE customer ( -> id INT AUTO_INCREMENT PRIMARY KEY, -> name VARCHAR(50), -> email VARCHAR(50) -> ); Query OK, 0 rows affected (0.011 sec)
Show the table was created :
MariaDB [dbtestku]> show tables; +--------------------+ | Tables_in_dbtestku | +--------------------+ | customer | +--------------------+ 1 row in set (0.001 sec)

So, here is the end of short tutorial.
Conclusion
That’s it! We’ve successfully installed MySQL on openSUSE. We can now start creating databases, tables, and managing our MySQL server. Remember to consult the official MySQL documentation for more advanced configuration and usage options: MySQL Documentation.