Custom DB_COLLATE (collation) value not working on fresh install?


I always knew that WordPress uses utf8_general_ci as tables collation, but recently it keeps installing utf8mb4_unicode_520_ci.

What I do is:

  1. Download WordPress from
  2. Rename wp-config-example.php to wp-config.php
  3. Set the defined constants as below

    /** Database Charset to use in creating database tables. */  
    define('DB_CHARSET', 'utf8');
    /** The Database Collate type. Don't change this if in doubt. */  
    define('DB_COLLATE', 'utf8_general_ci');  
  4. Set database configuration properly and create an empty database with charset and collation as above.

  5. Open where the WordPress is extracted and run the WordPress installation.
  6. Everything installed properly, now view my database settings AND BOOM, the tables have charset utf8mb4 and collation utf8mb4_unicode_520_ci. Side note : Some plugins that I install later will have tables collation utf8_general_ci …

Running mysql --version on my machine returns:

mysql  Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using  EditLine wrapper

Note: If I use default DB_COLLATE and DB_CHARSET (omit my definitions), the tables get utf8mb4_unicode_520_ci, looks like that is the default now.

So, how do I tell WordPress to create the tables with the proper encoding ?

Thanks in advance.

George Dimitriadis 4 months 0 Answers 15 views 0

Leave an answer