Solving MySQL Secure Installation Password Issue on Red Hat Enterprise Linux 8

Abstract: Resolves MySQL Secure Installation skipping root password prompts on RHEL 8 by switching auth_socket to caching_sha2_password.

Created: 2026-08-06 by
MySQL Secure Installation on RHEL 8 does not prompt for a root password because the default authentication plugin is auth_socket, which validates users based on their operating system user account rather than a password. To resolve this, you must switch the root user’s authentication method to mysql_native_password or caching_sha2_password and explicitly set a strong password using the MySQL client command line. This ensures that remote connections and standard administrative workflows function as expected without relying solely on local OS-level access.

Understanding the Authentication Mechanism

When you install MySQL Server on Red Hat Enterprise Linux 8 via the yum or dnf package manager, the initialization process creates a root account that is configured to use the auth_socket plugin by default. This plugin is designed for security; it allows the root user to connect from the localhost only if the OS username matches the MySQL username. Because of this design, the mysql_secure_installation script skips the step where it would normally ask you to define a password. It assumes that if you have shell access to the server, you already have full control over the database. This behavior is intentional to prevent weak passwords from being set during automated deployments, but it can be confusing for administrators who expect a traditional password-based login. If you attempt to connect remotely using the root account with a password, the connection will fail because the socket plugin ignores any password provided. You need to manually alter the authentication method to enable password-based logins for both local and remote access.

Switching Authentication Plugins

To fix the issue, you must first gain access to the MySQL monitor using your current OS privileges. Since you are logged in as root or a user with sudo privileges, you can execute the following command:
sudo mysql
Once inside the MySQL prompt, you need to identify the current authentication plugin for the root user. Run this query to check the configuration:
SELECT user, host, plugin FROM mysql.user WHERE user = 'root';
You will likely see auth_socket listed in the plugin column. To change this, you should update the root user to use mysql_native_password or the newer caching_sha2_password. The latter is recommended for MySQL 8.0 as it provides better performance and security. Execute the following command to set the password and change the plugin simultaneously:
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'YourStrongPassword123!';
Replace YourStrongPassword123! with a complex password that meets your organization's security policies. After running this command, flush the privileges to ensure the changes take effect immediately:
FLUSH PRIVILEGES;
Exit the MySQL monitor by typing exit. You can now verify the change by attempting to log in with the new password:
mysql -u root -p
If you enter the password you just set and gain access, the issue is resolved. This approach directly addresses the lack of a prompt during installation by manually configuring the credentials after the fact.

Configuring Remote Access and Security

Changing the root password allows local password-based login, but it does not automatically enable remote connections. By default, the root user is restricted to connecting only from localhost. If you need to manage the database from another machine, you must create a separate user or modify the root host permissions. Creating a dedicated admin user is generally safer than exposing the root account. Create a new user with remote capabilities using this pattern:
CREATE USER 'admin'@'%' IDENTIFIED BY 'AnotherStrongPassword!';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
The % wildcard allows connections from any IP address. However, this introduces significant security risks if not properly managed. Ensure that your firewall rules on RHEL 8 allow traffic on port 3306 only from trusted networks. You can manage these rules using firewalld:
sudo firewall-cmd --permanent --add-port=3306/tcp
sudo firewall-cmd --reload
Additionally, consider disabling remote root login entirely. It is best practice to use non-root accounts for daily operations. You can lock down the root user to localhost only after verifying that your application uses a specific user account for database interactions. This limits the attack surface significantly. For more insights on securing your server environment, you might find Securing an Ubuntu Server for Development Purposes useful, as many principles apply across Linux distributions.

Verifying the Setup

After making these changes, perform a comprehensive check to ensure everything is working correctly. First, test local connectivity with the new password. Then, test remote connectivity from a different machine using the client tool. Monitor the MySQL error log for any authentication failures:
sudo tail -f /var/log/mysqld.log
Look for entries related to Access denied or Plugin auth_socket. If you see repeated failures, verify that the correct plugin is assigned and that the password complexity meets the validate_password policy requirements. You can adjust these policies if needed by modifying the my.cnf configuration file under the [mysqld] section. For further context on how security updates impact database stability, reviewing Long Homebrew MySQL @ 8.0 Gets Security Updates can provide additional perspective on maintaining secure database environments.

Frequently Asked Questions

Why didn't MySQL ask for a password during installation?

MySQL on RHEL 8 uses the auth_socket plugin by default for the root user, which relies on OS-level authentication instead of a password. This design choice prioritizes security by preventing weak passwords and ensuring that only authorized system users can access the database locally.

Can I still use the root account for remote connections?

By default, the root account is restricted to localhost connections only. While you can change the host field to allow remote access, it is strongly discouraged due to security risks. Instead, create a dedicated user with specific privileges for remote management tasks.

What happens if I forget the root password after changing it?

If you lose the password, you must reset it by stopping the MySQL service, starting it with the --skip-grant-tables option, and then updating the user credentials directly. This method bypasses normal authentication checks but requires careful handling to avoid leaving the database in an insecure state.

Is auth_socket less secure than mysql_native_password?

auth_socket is considered more secure for local administration because it ties database access to the operating system user identity, eliminating the risk of password guessing or theft. However, it prevents remote connections and automation scripts that require password-based authentication from functioning seamlessly.

How do I check the current authentication plugin for all users?

You can view the authentication methods for all users by running SELECT user, host, plugin FROM mysql.user; in the MySQL monitor. This query helps you identify users who might still be using older or less secure plugins that need to be updated.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More