How to check the collation of a table in MySQL
Codemia Knowledge Hub ·
Run SHOW TABLE STATUS LIKE 'table_name' and read the Collation field, or query information_schema.tables for table_collation. Collation also exists at the database and column level, so a table check is not always the whole story when you are debugging case sensitivity, odd ORDER BY results, or comparison mismatches.
Check table collation with SHOW TABLE STATUS
The Collation field is the table's default collation. This is convenient in an interactive client because it also shows engine, row count, and other metadata.
Query information_schema.tables
For scripts, admin tooling, or checking many tables at once, query the metadata directly:
Check column collations too
Individual text columns can override the table collation:
If one column uses utf8mb4_bin while the table default is utf8mb4_unicode_ci, comparisons on that column can behave differently than you expect.
What collation changes in query results
Collation controls:
- case sensitivity
- accent sensitivity
- sort order
- string equality and grouping
A case-insensitive collation such as utf8mb4_general_ci treats Alice and alice as equal for many comparisons; a binary collation does not. That can subtly change results for WHERE, ORDER BY, GROUP BY, and unique indexes.
Check the database default
If new tables get surprising collations, look at the database defaults:
A table usually inherits its character set and collation from the database at creation time unless you set them explicitly. Changing the database default later does not change existing tables.
Change a table's collation
This is more than a metadata change. It can rebuild text columns and affect indexes, sorting, and comparisons, so run it carefully on production tables, especially large ones.
Debugging order for collation problems
- Database default collation
- Table default collation
- Individual column collations
- Session or query-level overrides
Working through the layers finds where behavior diverges instead of assuming the problem is at the table level.
Mistakes to avoid
- Checking only the table and forgetting that columns can override it.
- Assuming the database default still matches tables created long ago.
- Confusing character set with collation: they are related but not the same.
- Changing collation on a live table without considering indexes and application behavior.
- Debugging case sensitivity in the application when the cause is a database collation choice.
Related reading
- MySQL Cloning a MySQL database on the same MySql instance
- MySQL combine two columns into one column
- mysql command for showing current configuration variables
- Mysql command not found in OS X 10.7
- MySQL CONCAT returns NULL if any field contain NULL
- mysql_config not found when installing mysqldb python interface
- MySQL connection not working 2002 No such file or directory
- MySQL convert date string to Unix timestamp
System design interview problems on this topic
- Design a Distributed OLTP Database: solution and walkthrough
- Design a Wide Column Database: solution and walkthrough
- Design a Key Value Store: solution and walkthrough
- Design a Web Cache: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.