We’d like to welcome you to our tutorial about setting up MySQL and MariaDB databases on Garuda Linux. MySQL is a relational database management system (RDBMS) that uses SQL (Structured Query Language) queries to perform operations. It’s one of the most widely used languages for accessing and maintaining table records. Under the GNU license, MySQL is open-source and free software. The Oracle Corporation is in favor of it. MariaDB is a free and open source relational database with a SQL interface for data access. GIS and JSON capabilities have been added to MariaDB in recent editions. MariaDB is a MySQL fork that is actively developed by the open source community.
Features of MySQL | MariaDB Database
MySQL Features
Below are MySQL features;
- It is safe.
- System for Managing Relational Databases (RDBMS).
- Architecture of Client/Server.
- Efficiency of memory.
- It’s adaptable.
- Simple to use.
- Downloading is completely free.
- High performance.
- Compatibility with a variety of OS systems.
MariaDB Features
The following are MariaDB features;
- MariaDB is available under the GPL, LGPL, or BSD licenses.
- For dealing with different RDBMS data sources, MariaDB provides a variety of storage engines, including high-performance storage engines.
- MariaDB makes advantage of a well-known and widely used querying language.
- MariaDB supports a wide range of programming languages and operates on a variety of operating systems.
- PHP, one of the most popular web development languages, is supported by MariaDB.
- Galera cluster technology is available from MariaDB.
- MariaDB also has a number of procedures and commands that aren’t accessible in MySQL, as well as features that have a detrimental influence on performance.
Install MySQL | MariaDB Database on Garuda Linux
1. Install MySQL Database
Follow the steps below to install MySQL database on Garuda Linux.
Step 1. Update System
If possible, we usually recommend starting any program installation with an OS upgrade.
$ sudo pacman -Sy
:: Synchronizing package databases...
garuda 52.9 KiB 43.0 KiB/s 00:01 [---------------------------------------------------] 100%
core 117.5 KiB 166 KiB/s 00:01 [---------------------------------------------------] 100%
extra 7.7 MiB 3.63 MiB/s 00:02 [---------------------------------------------------] 100%
multilib 133.0 KiB 102 KiB/s 00:01 [---------------------------------------------------] 100%
chaotic-aur 633.5 KiB 521 KiB/s 00:01 [---------------------------------------------------] 100%
Step 2. Install MySQL Database
Run the following command to install MySQL database;
$ sudo pacman -S mysql
resolving dependencies...
looking for conflicting packages...
Package (3) New Version Net Change Download Size
chaotic-aur/libmysqlclient 9.2.0-1 6.79 MiB 1.55 MiB
chaotic-aur/mysql-clients 9.2.0-1 51.77 MiB 11.82 MiB
chaotic-aur/mysql 9.2.0-1 161.07 MiB 42.68 MiB
Total Download Size: 56.05 MiB
Total Installed Size: 219.64 MiB
:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
libmysqlclient-9.2.0-1-x86_64 1583.4 KiB 1191 KiB/s 00:01 [---------------------------------------------------] 100%
mysql-clients-9.2.0-1-x86_64 11.8 MiB 3.49 MiB/s 00:03 [---------------------------------------------------] 100%
mysql-9.2.0-1-x86_64 42.7 MiB 6.43 MiB/s 00:07 [---------------------------------------------------] 100%
Total (3/3) 56.1 MiB 7.54 MiB/s 00:07 [---------------------------------------------------] 100%
(3/3) checking keys in keyring [---------------------------------------------------] 100%
(3/3) checking package integrity [---------------------------------------------------] 100%
(3/3) loading package files [---------------------------------------------------] 100%
(3/3) checking for file conflicts [---------------------------------------------------] 100%
(3/3) checking available disk space [---------------------------------------------------] 100%
:: Running pre-transaction hooks...
(1/2) Rejecting pacman transaction if running in snapshot...
(2/2) Performing snapper pre snapshots for the following configurations...
==> root: 13
:: Processing package changes...
(1/3) installing libmysqlclient [---------------------------------------------------] 100%
(2/3) installing mysql-clients [---------------------------------------------------] 100%
(3/3) installing mysql [---------------------------------------------------] 100%
warning: directory permissions differ on /run/
filesystem: 755 package: 775
:: You need to initialize the MySQL data directory prior to starting
the service. This can be done with mysqld --initialize command, e.g.:
mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
:: Additionally you should secure your MySQL installation using
mysql_secure_installation command after starting the mysqld service
Optional dependencies for mysql
perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format, mysql_setpermission, mysqldumpslow
:: Running post-transaction hooks...
(1/9) Creating system user accounts...
Creating group 'mysqlrouter' with GID 88.
Creating user 'mysqlrouter' (MySQL) with UID 88 and GID 88.
Creating group 'mysql' with GID 89.
Creating user 'mysql' (MySQL) with UID 89 and GID 89.
(2/9) Reloading system manager configuration...
(3/9) Creating temporary files...
(4/9) Arming ConditionNeedsUpdate...
(5/9) Foreign/AUR package notification
reiserfsprogs 3.6.27-4
xwaylandvideobridge 0.4.0-2
(6/9) Orphaned package notification...
argon2 20190702-6
gcab 1.6-2
gdk-pixbuf-xlib 2.40.2-3
http-parser 2.9.4-2
lib32-libcanberra 1:0.30+r2+gc0620e4-3
libomxil-bellagio 0.9.3-5
libsmbios 2.4.3-8
wpebackend-fdo 1.14.3-2
xorg-xsetroot 1.1.3-2
(7/9) Checking for .pacnew and .pacsave files...
.pac* files found:
/etc/issue.pacnew
/etc/locale.gen.pacnew
/etc/pacman.conf.pacnew
/etc/makepkg.conf.d/rust.conf.pacnew
/etc/pacman.d/mirrorlist.pacnew
/etc/updatedb.conf.pacsave
Please check and merge
(8/9) Performing snapper post snapshots for the following configurations...
==> root: 14
(9/9) Syncing all file systems...
For efficiency reasons, if you use the Btrfs filesystem, which you probably are, you should disable copy-on-write for the database directory:
sudo chattr +C /var/lib/mysql/
Initialize database server using the commands below:
sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Start the mysqld
service.
sudo systemctl enable --now mysqld.service
Check that MySQL is running correctly:
$ sudo systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
Active: active (running) since Tue 2025-03-25 09:47:15 EAT; 36s ago
Invocation: 364a955f4189481f82fc1d80789b3ebb
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3805 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 3828 (mysqld)
Status: "Server is operational"
Tasks: 36 (limit: 7074)
Memory: 578.3M (peak: 579.1M)
CPU: 754ms
CGroup: /system.slice/mysqld.service
└─3828 /usr/bin/mysqld
Mar 25 09:47:14 garuda.cloudspinx.com mysqld[3828]: 2025-03-25T06:47:14.410887Z 0 [System] [MY-015015] [Server] MySQL Server - start.
...
Mar 25 09:47:15 garuda.cloudspinx.com systemd[1]: Started MySQL Server.
2. Install MariaDB Database Server
Follow the steps below to install MariaDB database on Garuda Linux.
Step 1. Update System
$ sudo pacman -Sy
:: Synchronizing package databases...
garuda 52.9 KiB 43.0 KiB/s 00:01 [---------------------------------------------------] 100%
core 117.5 KiB 166 KiB/s 00:01 [---------------------------------------------------] 100%
extra 7.7 MiB 3.63 MiB/s 00:02 [---------------------------------------------------] 100%
multilib 133.0 KiB 102 KiB/s 00:01 [---------------------------------------------------] 100%
chaotic-aur 633.5 KiB 521 KiB/s 00:01 [---------------------------------------------------] 100%
Step 2. Install MariaDB Database
Run the following command to install MariaDB database:
$ sudo pacman -S libmariadbclient mariadb mariadb-clients
:: There are 3 providers available for libmariadbclient:
:: Repository extra
1) mariadb-libs 2) mariadb-lts-libs
:: Repository chaotic-aur
3) libmysqlclient
Enter a number (default=1):
resolving dependencies...
looking for conflicting packages...
Package (3) New Version Net Change Download Size
extra/mariadb 11.7.2-1 189.55 MiB 27.37 MiB
extra/mariadb-clients 11.7.2-1 31.76 MiB 1.81 MiB
extra/mariadb-libs 11.7.2-1 21.43 MiB 5.44 MiB
Total Download Size: 34.62 MiB
Total Installed Size: 242.74 MiB
:: Proceed with installation? [Y/n] Y
The above output shows that the conflicting packages are removed i.e percona-server are in conflict used to install mysql.
For efficiency reasons, if you use the Btrfs filesystem, you should disable copy-on-write for the database directory:
sudo chattr +C /var/lib/mysql/
Initialize database server using the commands below:
$ sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
OK
To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mariadbd-safe --datadir='/var/lib/mysql'
You can test the MariaDB daemon with mariadb-test-run.pl
cd '/usr/mariadb-test' ; perl mariadb-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
Start and enable mariadb
service:
sudo systemctl enable --now mariadb.service
Securing Mysql | MariaDB Database Server
You can now protect your database server by following these steps:
$ sudo mariadb-secure-installation
#OR
$ sudo mysql_secure_installation
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] Y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
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!
Creating Database Mysql | MariaDB Database Server
As the root user, launch MariaDB | MySQL Shell:
$ mariadb -u root -p
#OR
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 11.7.2-MariaDB Arch Linux
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)]>
Create database by the name my_db
:
create database my_db;
Create user by the name user_a
:
create user user_1@localhost identified by 'StrongPassw0rd';
Remember to replace ‘StrongPassw0rd‘ with your password.
Now let’s grant all the privileges to the my_db database with the following command:
grant all privileges on my_db.* to 'user_1'@'localhost';
We can now flush the privileges using the following command:
MariaDB [(none)]> flush privileges;
Issue the following command to check the databases:
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| my_db |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.003 sec)
Drop a database my_db
:
DROP DATABASE my_db;
Exit Mysql | MariaDB database:
MariaDB [(none)]> exit;
Bye
Conclusion
Thank you for reading this tutorial on how to install MySQL | MariaDB Database on Garuda Linux. We hope you found it useful; if you have any questions, please let us know in the comments section below.
Video Courses to Learn MySQL / MariaDB Databases:
- The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert
- SQL – MySQL for Data Analytics and Business Intelligence
- MySQL, SQL and Stored Procedures from Beginner to Advanced
- SQL for Beginners: Learn SQL using MySQL and Database Design
- The Complete MySQL Developer Course
- MySQL Database Administration: Beginner SQL Database Design
- Learn Database Design with MySQL
Similar Articles;