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 distro MySQL client packages such as mysql or mysql8.4 install 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:

  1. Open a terminal session with an account that can use sudo.
  2. Build a fresh dnf metadata cache before installing database client packages.
    $ sudo dnf makecache
    Rocky Linux 9 - BaseOS                          3.5 MB/s | 4.7 MB     00:01
    Rocky Linux 9 - AppStream                       4.4 MB/s |  10 MB     00:02
    Rocky Linux 9 - Extras                           17 kB/s |  17 kB     00:00
    Metadata cache created.
  3. Decide whether the host should carry the MariaDB client family or the distro MySQL client family. Use one of the next two install steps, not both.

    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.

  4. 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.

  5. 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.

  6. 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!

    RHEL 10 documents MySQL 8.4 as the current Application Stream, and Fedora's current mysql8.4 package metadata exposes mysql8.4 alongside mysql client subpackages. If dnf install mysql is not available on the target release, install the matching versioned client package from the enabled repositories.

  7. 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.

  8. Run a one-shot query against the remote database server with the installed client.
    $ mysql --host=db-01.example.net --user=appuser --password --execute="SELECT 1;"
    Enter password:
    +---+
    | 1 |
    +---+
    | 1 |
    +---+

    Use mariadb --host=db-01.example.net --user=appuser --password --execute="SELECT 1;" 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.