MySQL Server Hangs at "Setting up mysql-server" on Ubuntu: Kill the Bootstrap mysqld, Then Fix ERROR 1524

Abstract: mysql-server installs that stall at 'Setting up mysql-server' are the package's bootstrap server failing to exit; kill that mysqld, then move root to caching_sha2_password as 8.4 disables mysql_native_password.

Created: 2026-11-02 by

If apt install mysql-server stalls forever at "Setting up mysql-server", the package manager itself is fine: the MySQL package's configuration script has launched a temporary mysqld to bootstrap the root account, and that instance is not exiting. Kill the temporary server, let the configuration finish, then repair the root account's authentication plugin — MySQL 8.4 ships with mysql_native_password disabled, which is why logins afterward fail with ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded. A clean reinstall of Ubuntu avoids none of this, because the same bootstrap path runs on a fresh install too.

What the package is doing when it "freezes"

When dpkg configures mysql-server, it runs the post-installation script at /var/lib/dpkg/info/mysql-server.postinst. That script starts a private, throwaway MySQL server for first-time setup: mysqld runs as the mysql user with a generated --init-file under /var/lib/mysql-files/ containing the bootstrap SQL, and a temporary Unix socket in a fresh /tmp directory instead of the normal one. The script then waits for that server to process the init file and shut down.

The update-alternatives line you see is just the previous step completing; everything after it happens silently inside the postinst. If the bootstrap SQL fails — for instance because it references the now-disabled native password plugin — or the temporary server simply never exits, the script waits indefinitely and the whole install looks frozen.

Confirm the diagnosis before killing anything

The process list tells the story. You should see a chain from apt through dpkg --configure --pending and debconf to mysql-server.postinst, plus a mysqld owned by the mysql user carrying --init-file=/var/lib/mysql-files/tmp.* and --socket=/tmp/tmp.*/mysqld.sock. That mysqld is the bootstrap instance, not your real database server.

Two checks are worth making first:

  • Give it a few minutes and watch the CPU time of the mysqld process; a genuinely stuck bootstrap sits near idle with no growing error log.
  • Read /var/log/mysql/error.log for entries written by the temporary server around the hang — they usually reveal which bootstrap statement failed. While the hang is live, the generated init file still exists in /var/lib/mysql-files/ and shows exactly what the script was trying to run.

Unblocking the stuck configuration

Kill only the temporary mysqld — the process with the --init-file and the temporary socket — not apt or dpkg. Terminating the bootstrap server lets the postinst continue, and the usual "Processing triggers" lines follow as the install completes. Never kill apt or dpkg mid-configure; that is what leaves packages half-configured. If that has already happened, sudo dpkg --configure -a retries the pending configuration.

Fixing ERROR 1524 by moving accounts to caching_sha2_password

MySQL 8.4 disables mysql_native_password by default, and the 9.x series removes it entirely; caching_sha2_password is the supported default. Any account still flagged for the old plugin — including root@localhost when the bootstrap was interrupted — cannot log in, and the server reports that the plugin is not loaded.

sudo mysql still works even with password logins broken, because as the system root you connect over the local Unix socket and the server trusts that identity without a password check. Use it to see the damage and fix it:

SELECT user, host, plugin FROM mysql.user WHERE plugin = 'mysql_native_password';

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your-password';

Repeat the ALTER USER for every other account the query returns. After that, ordinary password logins with the mysql client work again.

If some legacy client genuinely cannot speak caching_sha2_password, MySQL 8.4 can re-enable the old plugin: add mysql_native_password=ON under the [mysqld] section of /etc/mysql/mysql.conf.d/mysqld.cnf and restart MySQL. Treat this as a bridge only — the option disappears in 9.x — and note that enabling it before running the package configuration can also let a bootstrap that depends on the plugin complete cleanly.

Preventing it on the next upgrade

  • Before a release upgrade that moves MySQL between major versions, confirm every account uses caching_sha2_password and take a dump of your users and data.
  • If a package configure ever hangs again, resist killing apt: identify the child process dpkg is waiting on and read that process's log first.
  • Remember that the temporary bootstrap server holds no data of yours, so killing it costs nothing — the real server is started separately after configuration.

Frequently Asked Questions

Why does sudo mysql work without a password?

Root on the host connects through the local Unix socket, and the server maps that identity to the MySQL root account without a password check. That socket path does not depend on any password plugin, so it survives even when plugin-based logins are broken.

Is it safe to kill mysqld during the install?

It is safe to kill the temporary bootstrap instance — the one with --init-file and a /tmp/tmp.*/ socket. The real system server starts separately after configuration, so the bootstrap copy holds nothing you could lose.

Can I keep mysql_native_password enabled for good?

On MySQL 8.4 you can re-enable it in the server config, but it is deprecated there and removed in 9.x, so anything relying on it breaks at the next major upgrade. Plan the move to caching_sha2_password instead.

How do I list accounts using the old plugin?

Run SELECT user, host, plugin FROM mysql.user; — any row showing mysql_native_password needs an ALTER USER ... IDENTIFIED WITH caching_sha2_password.

The install still hangs after killing mysqld — what next?

Check /var/log/mysql/error.log for the bootstrap server's errors, then run sudo dpkg --configure -a to retry. If it stalls at the same point again, the log entry identifies the statement the init file chokes on.

Does a fresh Ubuntu install avoid the problem?

No. The same postinst bootstrap and the same 8.4 plugin default apply to a clean install, so a from-scratch reinstall reproduces both the hang and the ERROR 1524.

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