# Laravel: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client [caching_sha2_password]

**Code:** `SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client` · **Category:** Laravel · **Seen on:** Laravel, PHP, MySQL

The PHP MySQL driver doesn't support the authentication plugin MySQL 8 uses (`caching_sha2_password`).

## Meaning

Use a PHP/MySQLnd version that supports it (PHP 7.4+), or change the user to the older plugin: `ALTER USER 'app'@'%' IDENTIFIED WITH mysql_native_password BY 'pass';`. Docker MySQL 8 with old PHP images triggers this frequently; updating PHP is the better fix.

## Common causes

- PHP older than 7.4 with MySQL 8
- mysqlnd/libmysql too old
- User created with caching_sha2_password
- Old PDO driver in a legacy Docker image
- Mixed MariaDB/MySQL client versions

## Quick fix

1. Upgrade PHP (7.4+ / 8.x)
2. Or `ALTER USER ... IDENTIFIED WITH mysql_native_password BY '...'`
3. Or start MySQL with `--default-authentication-plugin=mysql_native_password`

## Detailed fix by platform

### MySQL

1. `ALTER USER 'app'@'%' IDENTIFIED WITH mysql_native_password BY 'secret'; FLUSH PRIVILEGES;`

## How to diagnose

1. **PHP** — Version?
2. **Plugin** — User's auth plugin?
3. **Docker** — MySQL 8 image?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/laravel/mysql-auth-method-unknown-2054)
