1
votes

I have configured cakephp3 using cake offical document on Centos 6. below are the php and mysql version detail,

php -v
PHP 5.6.40 (cli) (built: Jan 12 2019 09:19:57)

mysql
Server version: 5.7.25 MySQL Community Server

I follow the below doc to configure: https://book.cakephp.org/3.0/en/quickstart.html

While run development server now I am getting below error.

CakePHP is NOT able to connect to the database. Connection to database could not be established: SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/)

1
Would you might provide your code so we can review it and find the possible error? - Michi Gruber
Hi @Gaurav, in the examples on site you linked, table definitions specify CHARSET=utf8mb4 and 'encoding' => 'utf8mb4'. I suggest you read about MySQL character sets. As a first step, change 'utf8mb4' to 'utf8'. - marekful

1 Answers

2
votes

Replace

<charset name = "utf8"> in /usr/share/mysql/charsets/Index.xml with <charset name = "utf8mb4">.

its works for me.