MySQL logs keep warning that sha256_password is deprecated
Server error log lines that name the sha256_password plugin as deprecatedShort 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.
Fix it fast
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';2Match what you see, then jump to its fix
What does the error look like?
Server error log lines that name the sha256_password plugin as deprecatedSELECT ... 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
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
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
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 fixDatabases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
A query on Aurora MySQL dies with 'table /rdsdbdata/tmp/#sql... is full'
ERROR 1114 (HY000): The table '/rdsdbdata/tmp/#sqlfd_1586_2' is full
In Aurora MySQL 3, internal temporary tables share one pool, and when that pool and the memory-mapped overflow file are used up, a reader instance ends the query with error 1114.
3 causes, each with a fixDatabases
Azure Database for MySQL refuses a connection that does not use SSL
ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.
Azure Database for MySQL Flexible Server requires encrypted connections by default (require_secure_transport = ON, TLS 1.2).
4 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
DBeaver fails to resolve Maven dependencies when downloading a database driver
A driver library does not download automatically
DBeaver downloads driver jars from a Maven repository.
3 causes, each with a fix