Skip to content
Runbook

Install MySQL on Fedora / RHEL

Popular open source SQL relational database.

Databasesqlrdbmsrelationaldatabaseacid

Installation

Server (Fedora repositories) · dnf
sudo dnf install -y community-mysql-server

Fedora packages Oracle MySQL as community-mysql; mariadb is a separate package.

Verify the installation

Verify
mysql --version

Service

Start
sudo systemctl start mysqld
Stop
sudo systemctl stop mysqld
Status
sudo systemctl status mysqld
Restart
sudo systemctl restart mysqld
On boot
sudo systemctl enable mysqld

Important files

TypePathDescription
config/etc/my.cnfMain configuration file (includes /etc/my.cnf.d).
data/var/lib/mysqlData directory.
log/var/log/mysql/mysqld.logServer log.

Default ports

3306

Command-line tools

  • mysqlInteractive SQL client.
  • mysqladminAdministrative client.
  • mysql_secure_installationHardening script for the installation.

Uninstall

Uninstall
sudo systemctl stop mysqld
sudo dnf remove -y community-mysql-server

The /var/lib/mysql directory remains; delete it manually to wipe everything.

Good to know

  • The service unit is mysqld on Fedora (not mysql).
  • On first start, a temporary root password is written to the log; run mysql_secure_installation to finalize.
  • community-mysql is Oracle MySQL; the separate mariadb package would conflict on the same port.

Installation on Fedora

Fedora packages Oracle MySQL as community-mysql. sudo dnf install -y community-mysql-server installs the server; enable and start it with sudo systemctl enable --now mysqld. Note the unit is mysqld, not mysql.

First connection and security

On the first start, MySQL writes a temporary root password to /var/log/mysql/mysqld.log. Retrieve it, then run mysql_secure_installation to set a permanent password and apply secure defaults.

MySQL vs MariaDB on Fedora

Fedora also ships mariadb. The two cannot run on port 3306 at the same time; pick one. This guide uses community-mysql for compatibility with upstream Oracle MySQL.