Skip to content

Commit 1985b42

Browse files
authored
Workaround for MySQL 8.4 and unknown users (#7136)
| Q | A |------------- | ----------- | Type | bug | Fixed issues | N/A #### Summary See https://bugs.mysql.com/bug.php?id=114876 for details. Failing test: https://github.com/doctrine/dbal/actions/runs/17474044585/job/49629574307?pr=7134#step:7:98 The MySQL 8.4 branch has a known bug which causes it to complain about the legacy password hashing plugin not being loaded if we try to login with an unknown user. This _sometimes_ causes our tests to fail. With this PR, I'm upcasting this error to the same exception which we would get for invalid credentials.
1 parent cd7da68 commit 1985b42

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Driver/API/MySQL/ExceptionConverter.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
2323
use Doctrine\DBAL\Query;
2424

25+
use function strpos;
26+
2527
/** @internal */
2628
final class ExceptionConverter implements ExceptionConverterInterface
2729
{
@@ -85,6 +87,15 @@ public function convert(Exception $exception, ?Query $query): DriverException
8587
case 1626:
8688
return new SyntaxErrorException($exception, $query);
8789

90+
case 1524:
91+
if (strpos($exception->getMessage(), 'Plugin \'mysql_native_password\' is not loaded') === false) {
92+
break;
93+
}
94+
95+
// Workaround for MySQL 8.4 if we request an unknown user.
96+
// https://bugs.mysql.com/bug.php?id=114876
97+
return new ConnectionException($exception, $query);
98+
8899
case 1044:
89100
case 1045:
90101
case 1046:

0 commit comments

Comments
 (0)