PHP PDOException:SQLSTATE [HY000] [2019]无法初始化字符集utf8mb4 [英] PHP PDOException: SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4

查看:644
本文介绍了PHP PDOException:SQLSTATE [HY000] [2019]无法初始化字符集utf8mb4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Centos 6上安装了drupal 8. 这是我的php和mysql -version输出

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

服务器版本:5.7.9 MySQL社区服务器(GPL) PHP 5.6.14(cli)(内置:2015年10月16日08:41:09)

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]无法在/var/www/m2m/core/lib/Drupal/Component/DependencyInjection/中初始化字符集utf8mb4(路径:/usr/share/mysql/charsets/)第83行的PhpArrayContainer.php

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

我的OS X上也有此配置 Mysql Server版本:5.6.27 Homebrew 和PHP 5.6.15(cli)(内置:2015年10月31日07:39:39)

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)

一切都很好.

你有什么主意吗? 任何帮助将不胜感激

Do you have any idea? Any help will be appreciated

推荐答案

我在CentOS上遇到了相同的问题,所有软件包都是最新的. 问题出在mysql驱动程序上.通过运行以下命令进行修复:

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

然后重新启动Web服务器.

And restarting the webserver.

这篇关于PHP PDOException:SQLSTATE [HY000] [2019]无法初始化字符集utf8mb4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆