MySQL and MariaDB are both renowned open-source relational database management systems that power countless applications and services across diverse domains. While MySQL has been a staple in the industry since 1995, MariaDB emerged as a promising fork in 2009 following Oracle's acquisition of MySQL. Boasting MySQL compatibility along with added features and improvements, MariaDB has garnered significant adoption over the years.

These RDBMS platforms offer a suite of clients and utilities that facilitate seamless management and interaction with databases. With these tools, users can effortlessly create and modify databases, execute SQL queries, and manage user accounts. This guide will provide a step-by-step walkthrough for installing MySQL or MariaDB clients on CentOS, Red Hat, and Fedora distributions, catering to an audience well-versed in database management systems.

The following steps are tailored to provide a streamlined installation experience, culminating in a fully functional MySQL or MariaDB client on your system. These instructions assume that you have a fundamental understanding of Linux systems and databases.

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

  1. Launch a terminal window on your CentOS, Red Hat, or Fedora system.
  2. Begin by updating your system packages with the following command.
    sudo dnf update -y
  3. If you are using CentOS or Red Hat, install the EPEL (Extra Packages for Enterprise Linux) repository.
    sudo dnf install epel-release -y
  4. Install your preferred RDBMS client.
    sudo dnf install mysql-community-client -y
    sudo dnf install mariadb-client -y
  5. Validate the successful installation of your chosen client by checking its version.
    mysql --version
    mariadb --version
  6. (Optional) To enhance your user experience with SQL command autocompletion, install the bash-completion package.
    sudo dnf install bash-completion -y
  7. (Optional) Activate autocompletion for the current session .
    source /etc/profile.d/bash_completion.sh
  8. (Optional) To enable autocompletion persistently, append the following line to your ~/.bashrc file.
    source /etc/profile.d/bash_completion.sh
  9. Subsequently, reload your bash profile with the command.
    source ~/.bashrc
Discuss the article:

Comment anonymously. Login not required.