“The MySQL service could not be started. The service did not report an error.” after upgrading to MySQL 8.4

This article discusses how to resolve a "The MySQL service could not be started" error after upgrading to MySQL 8.4.

The Error

After upgrading to MySQL version 8.4, attempting to net start MySQL results in the following output on the console

The MySQL service is starting..
The MySQL service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

You will also find the following written to the MySQL error log

[ERROR] unknown variable 'default_authentication_plugin=mysql_native_password'

More Info

This is likely the result of an intentional change under MySQL 8.4 and is not an operating system or software error.

mysql_native_password uses the SHA1 hashing algorithm, which has been deemed to be computationally insecure and has routes to hash exploitation that could in theory be used to undermine the security of users accounts on your MySQL server. Consequently Oracle replaced with with the newer, SHA2 based caching_sha2_password starting with MySQL 8.0 and 5.7.23 [source] during 2018.

MySQL 8.4 finally disabled the feature under upgrade installations, however for the time being there is a way to re-enable it. This workaround will itself be removed in a future release.

The Fix

Note: Before you proceed, ensure that your Visual C++ 2019 runtime is current from the Microsoft Download Centre.

The error is likely caused by the following changelog entry noted in the MySQL 8.4 documentation.

MySQL native password authentication changes.  Beginning with MySQL 8.4.0, the deprecated mysql_native_password authentication plugin is no longer enabled by default. To enable it, start the server with --mysql-native-password=ON (added in MySQL 8.4.0), or by including mysql_native_password=ON in the [mysqld] section of your MySQL configuration file (added in MySQL 8.4.0).

To re-enable mysql_native_password as expeditiously as possible:

  1. Locate and open your main MySQL config file (my.ini)
  2. Locate the line
    default_authentication_plugin = mysql_native_password
  3. Comment out the entire line using the # character i.e.
    #default_authentication_plugin = mysql_native_password
  4. Save the file, ensuring that you save it with ANSI encoding and not UTF-8 or Unicode encoding

If you are running MySQL as a service

  1. On your MySQL Server open regedit
  2. Navigate to
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL
    Note:
    If your service is named something else, replace MySQL with the registered name of the service
  3. Edit the ImagePath value to read:
    "C:\Program Files\MySQL\Server\bin\mysqld" --mysql-native-password=ON MySQL
  4. Exit regedit
  5. Reboot the server
  6. MySQL should start

If you are running MySQL from the command line

  1. Edit your shortcut so that the load call to mysqld.exe includes
    --mysql-native-password=ON

 

Please Note: That this fix is a workaround for a deprecated feature and you should look to switch to using caching_sha2_password on your server as soon as possible. At which time you should remove references to --mysql-native-password=ON to restore the default state. Alternatively, you can set its value to OFF to have the same effect.

To change, use MySQL Workbench, phpMyAdmin or the following SQL statement to switch the user to the new caching_sha2_password scheme:

ALTER USER myuser IDENTIFIED WITH caching_sha2_password BY 'mypassword';

Or reset the password for each account through the UI, selecting caching_sha2_password as the password hash type.