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
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
8.0.1
PHP version: 7.1.3
7.1.3
Driver: pdo_mysql
pdo_mysql
charset: UTF8
UTF8
dsn: "mysql:host=mysql;dbname=database;charset=UTF8;"
"mysql:host=mysql;dbname=database;charset=UTF8;"
Any ideas?
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?
(, !!!), , -
MySQL 8.0.11 , PHP mysqli_connect(). MySQL ( , usr/local/mysql) my.cnf, , MySQL. :
mysqli_connect()
usr/local/mysql
my.cnf
mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
default_authentication_plugin = mysql_native_password, my.cnf :
default_authentication_plugin = mysql_native_password
[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
>
:
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/
, MySQL 8 " ( MySQL 5.x)", .
.
[MySQLi] php.ini mysqli.default_charset = "UTF-8". [Pdo_mysql] [mysqlnd].
[MySQLi]
php.ini
mysqli.default_charset = "UTF-8"
[Pdo_mysql]
[mysqlnd]
, -, MySQL 8.0, , PHP 7.2, PHP 7.0
, /etc/my.cnf -
After saving, I went into the system settings, stopped the MYSQL server and started again, and everything worked.
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.
Source: https://habr.com/ru/post/1674917/More articles:How to combine two lists in Haskell - haskellWhat is the difference between an expression and a function in Python? - functionspring-boot-devtools: how to exclude java classes from restarting the application? - javaIs it safe to publish a domain event before saving the aggregate? - c #Возврат скопированного объекта - c++Changing the value of ThemeResource at run time is not reflected in other views - c #Jupyter laptop import error: no module named "matplotlib" - pythonHow to pass column names to dplyr function - functionTriple error when switching to 64-bit long - assemblyhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1674922/proper-way-of-applying-two-or-many-option-values-to-a-function-in-f&usg=ALkJrhhlU9VG-RTLw4wybJYUJ1jvNCHTuQAll Articles