cliffordp
8/26/2016 - 4:14 PM

get a WordPress site's database collation

get a WordPress site's database collation

/**
  * By Barry 2016-08-26
  *
  * Get a WordPress site's database collation
  *
  * NOTE: MUST change "tribeDBftict" to your own database name
  * NOTE: MAY NEED TO change "wp_" if you have a custom database prefix
  *
  * It should result like this in PHPMyAdmin: https://cl.ly/3V0O3x0B1B1R
  */

SELECT char_set.character_set_name

FROM information_schema.`TABLES` table_data,
     information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` char_set

WHERE char_set.collation_name = table_data.table_collation
AND   table_data.table_schema = "tribeDBftict"  -- change to your own database name
AND   table_data.table_name = "wp_postmeta"