Installing a database client on an RPM-based host enables remote administration and troubleshooting without running a local database daemon, which keeps the system lightweight while still supporting interactive queries, imports, and exports against a separate database server.

On CentOS, Red Hat, and Fedora, client tools arrive as packages that provide an interactive SQL shell plus the client libraries used to negotiate authentication and speak the MySQL protocol; on many MariaDB installs, the primary binary is mariadb with a compatible mysql symlink available on Unix-like systems.

Package names and repositories vary by distribution and vendor, and mixing Oracle MySQL community packages with distribution-provided MariaDB packages can trigger RPM conflicts or package replacement during routine upgrades when the Oracle MySQL Yum repository is enabled.

Steps to install MySQL or MariaDB client on CentOS, Red Hat, or Fedora:

  1. Open a terminal with sudo privileges.

    On CentOS 7, replace dnf commands with yum equivalents.

  2. Apply available updates with a metadata refresh.
    $ sudo dnf upgrade --refresh --assumeyes
    Last metadata expiration check: 0:00:21 ago on Fri 12 Dec 2025 10:22:15 AM UTC.
    Dependencies resolved.
    Nothing to do.
    Complete!
  3. Choose a single client family before installing packages.

    Due to conflicting RPM packages, installing both MariaDB and MySQL packages on the same host can fail, so remove one family before switching to the other.

  4. Install the MariaDB client from distribution repositories.
    $ sudo dnf install --assumeyes mariadb
    Dependencies resolved.
    ================================================================================
     Package          Architecture   Version               Repository      Size
    ================================================================================
    Installing:
     mariadb          x86_64         3:10.11.8-1.el9       appstream      6.5 M
    Installing dependencies:
     mariadb-common   x86_64         3:10.11.8-1.el9       appstream       30 k
    ##### snipped #####
    Complete!

    The mariadb package installs the client tools, while mariadb-server installs the server daemon.

  5. Verify the MariaDB client is available.
    $ mariadb --version
    mariadb  Ver 15.1 Distrib 10.11.8-MariaDB, for Linux (x86_64) using EditLine wrapper

    If mysql is required by scripts, the MariaDB client commonly provides a mysql symlink on Unix-like systems.

  6. Install the Oracle MySQL Yum repository release package for MySQL Community client packages.
    $ sudo dnf install --assumeyes https://dev.mysql.com/get/mysql84-community-release-el9-2.noarch.rpm
    mysql84-community-release-el9-2.noarch.rpm             14 kB/s | 15 kB 00:01
    Dependencies resolved.
    Installing:
     mysql84-community-release   noarch   el9-2   @commandline   15 k
    Complete!

    Match the release RPM to the platform, such as mysql84-community-release-el8-2.noarch.rpm, mysql84-community-release-el7-2.noarch.rpm, mysql84-community-release-fc42-3.noarch.rpm, or mysql84-community-release-fc41-2.noarch.rpm.

    The Oracle repository can upgrade and replace existing third-party MySQL packages during routine dnf upgrades, so enable it deliberately and track what repositories are allowed on the host.

  7. Install the MySQL Community client package from the enabled repository.
    $ sudo dnf install --assumeyes mysql-community-client
    MySQL 8.4 LTS Community Server                          44 kB/s | 76 kB 00:01
    Dependencies resolved.
    Installing:
     mysql-community-client   x86_64   8.4.6-1.el9   mysql84-community   5.2 M
    ##### snipped #####
    Complete!

    The mysql-community-client package contains the MySQL client applications and tools.

  8. Verify the MySQL client is available.
    $ mysql --version
    mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
  9. Test connectivity to a 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.
    mysql>

    Avoid passing passwords directly on the command line, because arguments can be visible in process listings and shell history.

Discuss the article:

Comment anonymously. Login not required.