FedoraRHEL Based

How To Install MySQL on Fedora 43

Install MySQL on Fedora 43

MySQL stands as the world’s most popular open-source relational database management system, powering millions of web applications, data-driven platforms, and enterprise solutions globally. Whether you’re a system administrator managing production servers, a developer building dynamic web applications, or a database enthusiast exploring Linux-based database solutions, understanding how to properly install and configure MySQL on Fedora 43 is an essential skill.

Fedora 43, released in October 2025, brings cutting-edge features including Linux kernel 6.17, DNF 5 package manager, and enhanced system performance. This latest Fedora release provides an excellent foundation for running MySQL 8.0 Community Edition, which offers significant performance improvements, enhanced security features, and robust JSON support. This comprehensive guide walks you through every step of installing MySQL on Fedora 43, from system preparation to security hardening and database creation.

Prerequisites and System Requirements

Before beginning the MySQL installation process, ensure your Fedora 43 system meets the necessary requirements. You’ll need a working Fedora 43 installation with root or sudo privileges to execute system-level commands. An active internet connection is essential for downloading packages from the MySQL Yum repository.

Basic familiarity with the Linux terminal and command-line interface will make the installation process smoother. Fedora 43 uses DNF (Dandified Yum) as its default package manager, an improved successor to the older YUM system. DNF provides faster dependency resolution, better memory usage, and cleaner command syntax.

One critical consideration: MariaDB and MySQL packages conflict because they provide similar files and cannot coexist on the same system. If MariaDB is currently installed on your Fedora 43 system, you must remove it completely before proceeding with MySQL installation. Verify your Fedora version by running cat /etc/fedora-release in the terminal.

Update Your Fedora System

Updating your Fedora 43 system before installing new software is a fundamental best practice that ensures compatibility and security. System updates patch security vulnerabilities, fix bugs, and update existing packages to their latest stable versions.

Open your terminal and execute the following command with sudo privileges:

sudo dnf update

This command refreshes the package metadata and upgrades all installed packages to their newest versions available in the Fedora repositories. The DNF package manager will display a list of packages to be updated and ask for confirmation before proceeding. Depending on how many packages require updates, this process may take several minutes.

Alternatively, you can use the refresh flag for a more thorough update:

sudo dnf upgrade --refresh

If kernel updates are installed during this process, reboot your system to ensure the new kernel is loaded. After the system restarts, verify the update completed successfully by checking for any error messages in the terminal output.

Choose Your MySQL Installation Method

Fedora 43 offers two primary methods for installing MySQL, each with distinct advantages. Understanding these options helps you make an informed decision based on your specific requirements.

Method 1: Fedora Default Repository – This approach uses the community-maintained MySQL package available directly from Fedora’s official repositories. The command sudo dnf install community-mysql-server installs a version tested specifically for Fedora compatibility. This method is simpler and requires fewer configuration steps, making it ideal for development environments or users who prefer Fedora-tested packages.

Method 2: Official MySQL Yum Repository – This method involves adding Oracle’s official MySQL repository to your system, providing access to the latest MySQL releases directly from the source. Currently, MySQL 8.4 LTS is the default version, though MySQL 8.0 and MySQL 9.x Innovation series are also available. This approach offers more control over which MySQL version you install and ensures you receive updates directly from Oracle.

For production environments and users requiring the most current features and security patches, Method 2 is recommended. This guide focuses on the official MySQL Yum repository method to provide access to the latest stable MySQL Community Server release.

Add the Official MySQL Yum Repository

Adding the official MySQL Yum repository to your Fedora 43 system is straightforward. The MySQL Yum repository provides RPM packages for installing not only the MySQL server but also client tools, MySQL Workbench, connectors, and utilities.

First, navigate to the MySQL official download page at https://dev.mysql.com/downloads/repo/yum/ to obtain the latest repository package for Fedora. Look for the repository RPM file matching Fedora 43 (the file will contain “fc43” or similar in its name).

Download the MySQL repository configuration package using wget:

wget https://dev.mysql.com/get/mysql84-community-release-fc43-1.noarch.rpm

Note that the exact filename may vary slightly depending on the current repository version. The repository setup RPM file name begins with mysql84, indicating that MySQL 8.4 LTS is enabled by default.

Install the downloaded repository package:

sudo dnf install mysql84-community-release-fc43-1.noarch.rpm

This command adds the MySQL Yum repository to your system’s repository list and downloads the GnuPG key for package signature verification. The installation process ensures the authenticity and integrity of packages you’ll download from the MySQL repository.

Import the GPG key for additional security:

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023

Verify the repository was added successfully by checking enabled repositories:

dnf repolist enabled | grep "mysql.*-community.*"

The output should display MySQL-related repositories including mysql-8.4-lts-community and mysql-tools-8.4-lts-community. This confirmation ensures your system can now access MySQL packages from Oracle’s official repository.

Install MySQL Community Server

With the MySQL repository configured, you can now install MySQL Community Server on your Fedora 43 system. The installation command automatically resolves dependencies and installs all required components.

Execute the following command to install MySQL:

sudo dnf install mysql-community-server

This single command installs multiple essential packages:

  • mysql-community-server: The main MySQL server daemon and configuration files
  • mysql-community-client: Command-line client tools for interacting with MySQL
  • mysql-community-common: Common files including error messages and character sets
  • mysql-community-libs: Shared client libraries required by applications

DNF will display the complete list of packages to be installed along with their total download size. Type ‘y’ and press Enter to confirm the installation. The download and installation process may take several minutes depending on your internet connection speed.

Once installation completes, verify MySQL was installed successfully:

mysql --version

This command displays the installed MySQL version information, confirming the database server is ready for configuration. You can also check installed MySQL packages using:

rpm -qa | grep mysql

Start and Enable MySQL Service

After installing MySQL Community Server, the service must be started manually and configured to launch automatically on system boot. Fedora 43 uses systemd for service management, providing robust control over system services.

Start the MySQL server service:

sudo systemctl start mysqld

Enable MySQL to start automatically at boot time:

sudo systemctl enable mysqld

These commands can be combined into a single operation if preferred. Check the MySQL service status to confirm it’s running properly:

sudo systemctl status mysqld

The status output displays several important details:

  • Active status: Should show “active (running)” in green
  • Process ID (PID): The main MySQL daemon process identifier
  • Memory usage: Current memory consumption
  • Recent log entries: Latest messages from the service

MySQL now listens on port 3306, the default MySQL server port. If the service fails to start, check the error log at /var/log/mysqld.log for diagnostic information.

Retrieve the Temporary Root Password

MySQL 8.0 implements strict security policies by generating a temporary root password during initial server startup. This security measure ensures the database isn’t accessible with a blank or default password.

Locate the temporary root password in the MySQL error log:

sudo grep 'temporary password' /var/log/mysqld.log

The output displays a line similar to:

[Note] A temporary password is generated for root@localhost: aB3#xYz!9pQr

Copy this temporary password carefully as you’ll need it immediately to access MySQL and set a permanent password. The temporary password contains a mix of uppercase letters, lowercase letters, numbers, and special characters.

If no temporary password appears in the log, you may have installed community-mysql-server from Fedora’s repository rather than mysql-community-server from Oracle’s repository. In this case, proceed directly to running the secure installation script.

Secure Your MySQL Installation

Running the MySQL secure installation script is a critical security step that hardens your database server against common vulnerabilities. This interactive script guides you through essential security configurations.

Execute the secure installation script:

sudo mysql_secure_installation

The script presents several security prompts:

Current Root Password: Enter the temporary password retrieved from the log file. The script will immediately require you to change this temporary password.

New Root Password: Create a strong password meeting MySQL’s validation requirements. The default validate_password plugin requires passwords to contain at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with a minimum length of eight characters.

Remove Anonymous Users: Select “Yes” to delete anonymous user accounts. Anonymous users represent a significant security risk as they allow unauthenticated access to the database server.

Disallow Root Login Remotely: Choose “Yes” to prevent root login from remote hosts. This configuration ensures the root account can only connect from localhost, enhancing security. For development environments where remote root access is necessary, you may choose “No,” but this is not recommended for production systems.

Remove Test Database: Select “Yes” to delete the test database. The test database is accessible to all users by default and serves no purpose in production environments.

Reload Privilege Tables: Choose “Yes” to apply all changes immediately. This step ensures your security configurations take effect without requiring a service restart.

Upon completion, the script confirms your MySQL installation is now secured. These security practices demonstrate expertise and build trust with users accessing your database server.

Log In to MySQL

With MySQL secured, you can now access the MySQL command-line interface using your newly created root password. The MySQL shell provides direct interaction with your database server.

Connect to MySQL as the root user:

mysql -u root -p

When prompted, enter the root password you set during the secure installation process. Successful authentication displays the MySQL prompt:

mysql>

This prompt indicates you’re connected to the MySQL shell and ready to execute SQL commands. Verify your MySQL version and installation:

SELECT VERSION();

The output displays your MySQL server version, confirming successful installation and configuration. To exit the MySQL shell, type:

EXIT;

Alternatively, you can use the quit; command. If you encounter login issues, verify the MySQL service is running with sudo systemctl status mysqld and ensure you’re using the correct password.

Create a Database and User

Creating separate databases and dedicated user accounts follows the principle of least privilege, a fundamental security best practice. Never use the root account for application connections.

Log into MySQL as root and create a new database:

CREATE DATABASE testdb;

Replace testdb with your desired database name. Database names should follow SQL naming conventions: alphanumeric characters and underscores only, no spaces.

List all databases to verify creation:

SHOW DATABASES;

Create a dedicated user account:

CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'SecureP@ssw0rd';

The @'localhost' specification restricts this user to local connections only, enhancing security. For users requiring remote access, specify the appropriate hostname or IP address instead of localhost.

Grant privileges to the new user on the specific database:

GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost';

This command grants comprehensive permissions on all tables within the testdb database. For more restrictive access, specify individual privileges like SELECT, INSERT, UPDATE, and DELETE rather than ALL PRIVILEGES.

Apply privilege changes immediately:

FLUSH PRIVILEGES;

Flushing privileges ensures MySQL reloads the grant tables, activating your changes without requiring a service restart. Exit the MySQL shell and test the new user account:

mysql -u testuser -p testdb

This command connects as testuser to the testdb database, verifying your user and database configuration.

Configure MySQL Settings

MySQL configuration files allow you to customize server behavior, optimize performance, and adjust security settings. The primary MySQL configuration file resides at /etc/my.cnf, with additional configurations in /etc/my.cnf.d/.

Best practice recommends creating custom configuration files rather than editing default system files. This approach prevents your changes from being overwritten during MySQL updates.

Edit the main configuration file:

sudo nano /etc/my.cnf

Key configuration directives include:

  • bind-address = 127.0.0.1: Restricts MySQL to accept connections only from localhost
  • port = 3306: Specifies the MySQL listening port (default)
  • max_connections: Controls maximum simultaneous client connections
  • innodb_buffer_pool_size: Allocates memory for InnoDB storage engine caching

After modifying configuration files, restart MySQL to apply changes:

sudo systemctl restart mysqld

Verify your configuration parameters:

/usr/libexec/mysqld --print-defaults

This command displays all active MySQL configuration values, helping you confirm your customizations.

Verify MySQL Installation

Thorough verification ensures your MySQL installation functions correctly. Check the MySQL service status:

sudo systemctl status mysqld

Confirm MySQL version information:

mysql --version

Verify MySQL listens on the correct port:

sudo ss -tlnp | grep 3306

Test database connectivity with your created user:

mysql -u testuser -p testdb

Execute a simple query to confirm MySQL responds properly:

SELECT NOW();

These verification steps confirm your MySQL server is installed correctly, running smoothly, and ready for production use.

Troubleshooting Common Issues

Service Fails to Start: If MySQL won’t start, check system logs with sudo journalctl -u mysqld.service -xe and examine the MySQL error log at /var/log/mysqld.log. Common causes include port conflicts, permission issues, or corrupted data directories.

Missing Temporary Password: This typically occurs when installing community-mysql-server instead of mysql-community-server. Simply proceed with mysql_secure_installation, which will function without the temporary password.

GPG Key Errors: Import the MySQL GPG key manually with sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 and clear the DNF cache using sudo dnf clean all.

MariaDB Conflicts: Remove MariaDB completely before installing MySQL using sudo dnf remove mariadb-server mariadb. Clean residual configuration files manually if necessary.

Connection Failures: Verify the service runs with sudo systemctl status mysqld and check that the socket file exists at /var/lib/mysql/mysql.sock. Firewall settings may also block connections.

Essential MySQL Management Commands

Mastering basic MySQL management commands streamlines database administration. Service management commands include:

sudo systemctl start mysqld    # Start MySQL
sudo systemctl stop mysqld     # Stop MySQL
sudo systemctl restart mysqld  # Restart MySQL
sudo systemctl status mysqld   # Check status

Database operation commands within the MySQL shell:

SHOW DATABASES;              # List all databases
USE database_name;           # Select a database
SHOW TABLES;                 # Display tables
DESCRIBE table_name;         # Show table structure

User management operations:

SELECT User, Host FROM mysql.user;                    # List users
SHOW GRANTS FOR 'username'@'localhost';               # View privileges
REVOKE privilege ON database.* FROM 'user'@'host';   # Remove privileges

Backup and restore operations:

mysqldump -u root -p database_name > backup.sql      # Backup database
mysql -u root -p database_name < backup.sql          # Restore database

These commands form the foundation of effective MySQL administration.

Best Practices and Security Recommendations

Always use strong, complex passwords for all MySQL user accounts. Create separate users for different applications, implementing the principle of least privilege. Never use the root account for application database connections.

Regular database backups are essential, with daily backups recommended for production environments. Keep MySQL updated with the latest security patches by running sudo dnf update mysql-community-server periodically.

Monitor MySQL logs regularly at /var/log/mysqld.log to identify potential issues early. Configure firewall rules appropriately if MySQL requires remote access, and implement SSL/TLS encryption for remote connections in production.

Set proper file permissions on the MySQL data directory and conduct regular security audits. Document your MySQL configuration and user credentials securely using a password manager or encrypted vault.

Congratulations! You have successfully installed MySQL. Thanks for using this tutorial for installing the MySQL database on your Fedora 43 Linux system. For additional or useful information, we recommend you check the official MySQL website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button