0

On one of our servers, WP-CLI seems to be convinced that the character set must be an empty string.

$ wp db cli
mysql: Character set '' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
ERROR 2019 (HY000): Can't initialize character set  (path: /usr/share/mysql/charsets/)

The database (MariaDB 10) has no problem connecting, nor does WordPress - the website is running fine. The character set is set to utf8mb4 across the board, including in wp-config.php. Why would it think it's ''?


Details

  • Ubuntu 18.04
  • PHP 7.2
  • WordPress 4.9
  • WP-CLI 2.1.0
$ wp cli info
OS: Linux 4.15.0-1031-aws #33-Ubuntu SMP Fri Dec 7 09:32:27 UTC 2018 x86_64
Shell:  /usr/sbin/nologin
PHP binary: /usr/bin/php7.2
PHP version:    7.2.10-0ubuntu0.18.04.1
php.ini used:   /etc/php/7.2/cli/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /path/to/htdocs
WP-CLI packages dir:    
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.1.0
mysql> select version();
+----------------------------------+
| version()                        |
+----------------------------------+
| 10.1.34-MariaDB-0ubuntu0.18.04.1 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.