Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

MySQL logs keep warning that sha256_password is deprecated

ErrorServer error log lines that name the sha256_password plugin as deprecated

Short answer

The sha256_password plugin is deprecated and will be removed in a future MySQL release. The warnings appear while accounts still use it. List the accounts that do, then move each one to caching_sha2_password with ALTER USER and update the app that uses it. New accounts must not name sha256_password.

  • Applies to MySQL 8.4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List every account that still uses the plugin. Each row is one login to migrate.

    SELECT user, host, plugin FROM mysql.user WHERE plugin = 'sha256_password';
  2. 2Match what you see, then jump to its fix

    1. 1The query above returns rowsExisting accounts still use sha256_passwordFix
    2. 2The warnings come back after you migrated the existing accountsNew accounts are being created with sha256_passwordFix

What does the error look like?

  • Server error log lines that name the sha256_password plugin as deprecated
  • SELECT ... FROM mysql.user WHERE plugin = 'sha256_password' returns rows

Cause 1 of 2

Existing accounts still use sha256_password

1Check

The manual says accounts that authenticate with sha256_password should be migrated to caching_sha2_password, the default plugin in MySQL 8.4, which covers what sha256_password does.

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

2Fix

Change the plugin for each account. The password must be given again. Update the password stored in the application or router config at the same time.

ALTER USER 'router_user'@'%'
  IDENTIFIED WITH caching_sha2_password BY 'new-strong-password';

3Verify

The query returns no rows, and the application logs in again.

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

Confirmed by dev.mysql.com

Did this fix it?

Cause 2 of 2

New accounts are being created with sha256_password

1Check

A provisioning script or CREATE USER statement may name the plugin. The authentication_policy variable only applies when accounts are created or altered, so changing it does not touch existing accounts.

SELECT @@authentication_policy;
SHOW CREATE USER 'router_user'@'%';

2Fix

Remove IDENTIFIED WITH sha256_password from the scripts. Name the new plugin, or leave it out to get the server default (caching_sha2_password in MySQL 8.4 with the default policy).

CREATE USER 'new_user'@'%'
  IDENTIFIED WITH caching_sha2_password BY 'a-strong-password';

3Verify

A new account shows caching_sha2_password.

SELECT user, plugin FROM mysql.user WHERE user = 'new_user';

Confirmed by dev.mysql.com

Did this fix it?

How do I stop it coming back?

  • Grep your provisioning scripts and infrastructure code for sha256_password.
  • After a plugin change, test the login without TLS as well: the manual says caching_sha2_password may need the server RSA public key then.
  • Change the stored password in the same maintenance step as the plugin.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Databases

JDBC says Public Key Retrieval is not allowed when connecting to MySQL

ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.

The account uses caching_sha2_password and your connection is not encrypted, so the client needs the server's RSA public key to send the password.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.