PDO :: __ construct (): the server sent charset (255), unknown to the client. Please inform developers

I am trying to connect to a MySQL database from a Symfony 3 application. But when I try to create a MySQL schema from the Symfony command console, I get this error: PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers

Both PHP and MySQL work in Docker containers.

MySQL version: 8.0.1

PHP version: 7.1.3

Driver: pdo_mysql

charset: UTF8

dsn: "mysql:host=mysql;dbname=database;charset=UTF8;"

Any ideas?

+27
source share
7 answers

MySQL 8 changed the default encoding to utfmb4. But some customers do not know this encoding. Therefore, when the server tells the client its default encoding, and the client does not know what the server means, it gives this error.

https://bugs.mysql.com/bug.php?id=71606

MySQL Connector/C++, PHP.

, , utf8, . /etc/my.cnf mysqld:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8

2010 : MySQL UTF-8 my.cnf?

+64

(, !!!), , -

MySQL 8.0.11 , PHP mysqli_connect(). MySQL ( , usr/local/mysql) my.cnf, , MySQL. :

mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

default_authentication_plugin = mysql_native_password, my.cnf :

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
default_authentication_plugin = mysql_native_password

!

: https://github.com/laradock/laradock/issues/1392

+16

>

:

localhost
Windows 10
PHP 5.6.31
MYSQL 8

:

default-character-set=utf8

:

c:\programdata\mysql\mysql server 8.0\my.ini

  • > C:\Program Files\MySQL\MySQL Server 5.5\my.ini

, :

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p

mysql> show variables like 'char%';

mysql> show variables like 'collation%';

\m/
+4

, MySQL 8 " ( MySQL 5.x)", .

.

!

+1

[MySQLi] php.ini mysqli.default_charset = "UTF-8". [Pdo_mysql] [mysqlnd].

, -, MySQL 8.0, , PHP 7.2, PHP 7.0

0

, /etc/my.cnf -

enter image description here

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8

After saving, I went into the system settings, stopped the MYSQL server and started again, and everything worked.

0
source

I had the same problem to connect to the local system.

I checked in the list of services (Run-> Services. Msc-> Enter) wampmysqld64 was stopped.

Restarted this. and was able to enter.

-2
source

Source: https://habr.com/ru/post/1674917/


All Articles