MySQL error 1251: Client doesn't support auth protocol
The server asked for an authentication method the client is too old to speak. Upgrade the client or driver, or change the account's plugin.
- Error number
1251- Name
ER_NOT_SUPPORTED_AUTH_MODE- SQLSTATE
08004- Category
- Connection and client
What it means
During login the server tells the client which authentication method to use. A client library that predates it, such as the old mysql package for Node.js talking to MySQL 8's caching_sha2_password, can't continue and reports 1251.
Common causes
- An old driver or client library connecting to MySQL 8.0 or later.
- The Node.js
mysqlpackage, which doesn't supportcaching_sha2_password;mysql2does. - Very old clients that only know the pre-4.1 password hashing.
How to fix it
-
Upgrade the client or driver (for Node.js, move to
mysql2). -
Check the account's plugin.
SELECT user, host, plugin FROM mysql.user WHERE user = 'app';
-
As a stopgap where the server still allows it, switch the account to
mysql_native_password. It is deprecated, and disabled by default in MySQL 8.4.ALTER USER 'app'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Related errors
2059Authentication plugin cannot be loaded2061Authentication plugin reported error1045Access denied for user
More connection and client errors
2002Can't connect through socket2003Can't connect to MySQL server on host2005Unknown MySQL server host2006MySQL server has gone away2013Lost connection to MySQL server during query2055Lost connection to MySQL server at stage2026SSL connection error3159Insecure transport prohibited
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.