Installing a SQL client on a CentOS Stream, RHEL, or Fedora host keeps the machine lightweight while still allowing remote queries, imports, exports, and troubleshooting against a separate database server. A client-only setup fits bastion hosts, application servers, and admin workstations that need database access without also running a local database daemon.
On current Red Hat family releases, dnf installs separate client packages for MariaDB and MySQL from the enabled repositories. The mariadb package provides the mariadb client plus the compatibility command name mysql, while the distro mysql package installs the MySQL command-line client and supporting shared files without the server service.
The safest workflow is to choose one client family and keep repository sources consistent. Current Fedora packages track newer source streams than EL9-style hosts, so the exact version reported by mariadb –version or mysql –version can differ by release, and mixing Oracle MySQL Community packages with distro-provided MySQL or MariaDB RPMs can cause package replacement or conflict churn during routine updates.
Steps to install a MySQL or MariaDB client on CentOS Stream, RHEL, or Fedora:
- Open a terminal session with an account that can use sudo.
- Refresh repository metadata and install pending system updates before adding database client packages.
$ sudo dnf upgrade --refresh --assumeyes Rocky Linux 9 - BaseOS 6.1 MB/s | 9.1 MB 00:01 Rocky Linux 9 - AppStream 6.4 MB/s | 12 MB 00:01 Rocky Linux 9 - Extras 24 kB/s | 17 kB 00:00 Dependencies resolved. ##### snipped ##### Complete!
- Decide whether the host should carry the MariaDB client family or the distro MySQL client family.
Install only one family at a time. Current RHEL documentation still warns that the MariaDB and MySQL package families conflict, and switching between them is cleaner after removing the previously installed client packages first.
- Install the MariaDB client package from the distro repository.
$ sudo dnf install --assumeyes mariadb Last metadata expiration check: 0:00:01 ago on Thu Apr 9 14:46:54 2026. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mariadb aarch64 3:10.5.29-3.el9_7 appstream 1.6 M Installing dependencies: mariadb-common aarch64 3:10.5.29-3.el9_7 appstream 27 k mariadb-connector-c aarch64 3.2.6-1.el9_0 appstream 194 k ##### snipped ##### Complete!
The mariadb package installs the client tools and libraries. The server daemon is a separate mariadb-server package.
- Verify that the MariaDB client is available.
$ mariadb --version mariadb Ver 15.1 Distrib 10.5.29-MariaDB, for Linux (aarch64) using EditLine wrapper
The same package also exposes the compatibility command name mysql on Linux systems where existing scripts still expect it.
- Install the distro MySQL client package when a MySQL CLI is preferred.
$ sudo dnf install --assumeyes mysql Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mysql aarch64 8.0.45-1.el9_7 appstream 2.7 M Installing dependencies: mariadb-connector-c-config noarch 3.2.6-1.el9_0 appstream 9.8 k mysql-common aarch64 8.0.45-1.el9_7 appstream 67 k ##### snipped ##### Complete!
On current Fedora releases, the same dnf install mysql workflow resolves to Fedora's newer mysql8.4 packaging, and current RHEL 10 documentation moves MySQL to the 8.4 Application Stream. If a newer RHEL release does not offer the unversioned mysql package, search the enabled repositories for available mysql8.4 packages first.
- Verify that the MySQL client is available.
$ mysql --version mysql Ver 8.0.45 for Linux on aarch64 (Source distribution)
If the host already uses Oracle's MySQL Community repository instead of distro packages, keep that vendor family consistent rather than mixing those RPMs with distro mysql or mariadb packages.
- Connect to the remote database server with the installed client.
$ mysql --host db.example.com --user appuser --password Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 21 Server version: 8.0.45 MySQL Community Server - GPL ##### snipped ##### mysql> exit Bye
Use mariadb --host db.example.com --user appuser --password instead when that better matches the installed client command or existing automation.
Avoid passing the password directly on the command line because arguments can be exposed through process listings and shell history.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
