PHP PDOException: SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4

偶尔善良 提交于 2019-12-07 06:05:33

问题


I have drupal 8 installed on Centos 6. Here is my php and mysql -version output

Server version: 5.7.9 MySQL Community Server (GPL) PHP 5.6.14 (cli) (built: Oct 16 2015 08:41:09)

But i still getting a connection error

PDOException: SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) in /var/www/m2m/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 83

I also have this configuration on my OS X Mysql Server version: 5.6.27 Homebrew and PHP 5.6.15 (cli) (built: Oct 31 2015 07:39:39)

and everything is ok.

Do you have any idea? Any help will be appreciated


回答1:


I had the same problem on CentOS, all packages up-to-date. Issue was with the mysql driver. Fixed by running the following:

yum erase php56w-mysql
yum install php56w-mysqlnd

And restarting the webserver.



来源:https://stackoverflow.com/questions/33834191/php-pdoexception-sqlstatehy000-2019-cant-initialize-character-set-utf8mb4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!