WordPress and MySQL 8
Hello,
I’m fan of new technologies and I love updates;))
For this reason, root.bg is now working on MySQL 8!
In this post I will share the special features of releasing version 8 and what we need to do our wordpress – especially if its base is large, old and with different types of charset and collation. To emphasize that I migrated from MariaDB 10.2 and for this purpose I picked up a new MySQL server – I did not do mysql_upgrade, and dump and restore the base!
More details about the new features in MySQL 8 can be found on their official site.
What is important for wordpress is precisely this :
- Character set support. The default character set has changed from
latin1
toutf8mb4
. Theutf8mb4
character set has several new collations, includingutf8mb4_ja_0900_as_cs
, the first Japanese language-specific collation available for Unicode in MySQL. For more information, see Section 10.10.1, “Unicode Character Sets”.
This is the problem I encountered after I poured the root.bg base of the new mysql server. Here are all the publications written in Cyrillic:
The reason for this is the encoding in MySQL.
This problem can be solved in two ways – by setting it on the server itself or in our wordpress configuration file.
Here are two ways:
In MySQL:
character-set-server=latin1
We can test this from mysql console:
SHOW VARIABLES LIKE 'character\_set\_%';
and we should see this result :
+--------------------------+---------+ | Variable_name | Value | +--------------------------+---------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | latin1 | | character_set_system | utf8 | +--------------------------+---------+ 7 rows in set (0.00 sec)
In wordpress:
In the wordpress configuration file – wp-config.php, we add the following line:
define('DB_CHARSET', 'latin1');
And now we have a working wordpress on MySQL 8!
P.S.
root.bg lives on :
ubuntu 18.04.1
nginx 1.14.0
php 7.2.11
mysql 8.0.13
memcached 1.5.6
Thats it!