In this post, I am sharing scripts find default character set of a MySQL Database, Table and Column.
Generally during the process of database migration, we are checking default character set and collation at MySQL Server level.
But in our production MySQL Server, I have also found that some of table has different character set which was actually not required.
As a database professional, this is our responsibility to maintain consistency between all database objects.
Find default Characater Set for Database:
WHERE schema_name = 'Database_Name';
Find default Characater Set for Table:
FROM information_schema.TABLES AS T
INNER JOIN information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS CCSA
ON CCSA.collation_name = T.table_collation
WHERE T.table_schema = 'Database_Name'
AND T.table_name = 'Table_Name';
Find default Character Set for Column:
WHERE table_schema = 'Database_Name'
AND table_name = 'Table_Name'
AND column_name = 'Column_Name';
Please Visit Other Related Articles !
Database Theory: What is Character Set and Collation
MySQL: How to change default Character set to UTF-8
MySQL: Perform Case Sensitive string comparison
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.