Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.5.24, 6.4.5, 22.08.4
-
None
Description
Having a server with
[server]
|
character-set-server = utf8mb3
|
collation-server = utf8mb3_swedish_ci
|
the command line client, return "utf8mb3_general_ci" as result of
SHOW VARIABLES LIKE 'collation_connection';
both when connecting to the MariaDB server directly, and when connecting via Maxscale.
A PHP program on the other hand also returns "utf8mb3_general_ci" when connecting via Maxscale, but "utf8mb3_swedish_ci" when connecting to MariaDB server directly.
This breaks PHP applications that do not explicitly set client character set / collation.
PHP test code I used:
<?php
|
|
function test($host) |
{
|
$mysqli = new mysqli($host,"vagrant","Secret23!"); |
if ($mysqli -> connect_errno) { |
echo "Failed to connect to MySQL: " . $mysqli -> connect_error; |
exit(); |
}
|
echo "Host: $host\n"; |
if ($result = $mysqli -> query("SHOW VARIABLES LIKE 'collation_connection'")) { |
while($row = mysqli_fetch_assoc($result)){ |
print_r($row); |
}
|
$result -> free_result(); |
}
|
echo "\n"; |
$mysqli -> close(); |
}
|
|
test("master"); |
test("maxscale"); |
?>
|
Note that PHP does not use a bundled version of libmysqlclient anymore by default, but its own "mysqlnd" implementation of the client protocol.