How to check character encoding settings in MySQL for databases, tables, and columns?

I’m working with a MySQL database and need to figure out what character encoding is being used at different levels. I want to know how to find out the current charset configuration for my entire database, specific tables within that database, and individual columns in those tables.

I’ve been having some issues with character display and think it might be related to encoding problems. Before I start making changes, I want to understand what encoding settings are currently in place.

Can someone show me the SQL commands or methods to check:

  • The default character set for a MySQL database
  • The character set used by specific tables
  • The character encoding for individual columns

Any help would be great since I’m not sure which system tables or commands to use for this information.

Skip the manual SQL queries every time you need to check encoding. I built an automated system that monitors charset inconsistencies across our whole database setup.

Sure, the commands others mentioned work for quick checks. But managing multiple databases? Automation beats manual work every time.

I used Latenode to create a workflow that hits our MySQL instances, runs charset queries automatically, and spits out reports showing database/table/column encoding mismatches. It flags mixed charsets that’ll cause display problems too.

Runs weekly and alerts us when it finds issues. We catch charset problems before users do instead of scrambling after complaints roll in.

For now, combine SHOW CREATE DATABASE with SELECT DEFAULT_CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='your_db' and that INFORMATION_SCHEMA.COLUMNS query lucasg shared. But seriously consider automating this if you’re juggling multiple databases.

hey, try SHOW CREATE DATABASE your_db_name; for the db charset and SHOW CREATE TABLE table_name; for table charsets. To check columns, use DESCRIBE table_name; but sometimes it’s not super clear. the CREATE statements are better.

Character encoding issues usually happen when MySQL components don’t match up. Check your MySQL config file (my.cnf or my.ini) for default-character-set and character-set-server settings - these control what happens when you create databases or tables without specifying a charset. I ran into this where apps created tables that inherited server defaults different from our utf8mb4 setup. Run SELECT @@character_set_database, @@character_set_server, @@collation_database; to see your current defaults. Also try SHOW COLLATION; to check available collations - mismatched collations can mess up sorting and comparisons even when the character sets look right.

Charset issues usually come from connection problems, not just storage settings. Run SHOW SESSION VARIABLES LIKE 'character_set%'; to check what your connection’s actually using - it can be different from your database defaults and mess up encoding even when tables are set up right. I’ve seen databases configured as utf8mb4 but connections running latin1, which garbles data on insert. Also try SHOW TABLE STATUS FROM your_database; for a quick overview of all tables and their collations. With legacy data, you’ll often find mixed charsets in the same database - that’s why some content looks fine while other parts are broken.

Skip DESCRIBE and go straight to INFORMATION_SCHEMA tables - they’ll give you way more detail. Run SELECT COLUMN_NAME, CHARACTER_SET_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='your_database' AND TABLE_NAME='your_table'; to see exactly what encoding each column uses. Also check SHOW VARIABLES LIKE 'character_set%'; for server defaults - this shows what happens when there’s no explicit charset set. Really helpful when you’re dealing with mixed encoding problems across different app versions.

quick tip - use mysql --default-character-set=utf8mb4 when connecting if you’re still seeing weird characters after checking those settings. sometimes the MySQL client uses the wrong encoding even when your server and database are set up right. saved me hours of debugging once.