How do I see what character set a MySQL database / table / column is?

前端 未结 15 1753
失恋的感觉
失恋的感觉 2020-11-22 06:33

What is the (default) charset for:

  • MySQL database

  • MySQL table

  • MySQL column

15条回答
  •  半阙折子戏
    2020-11-22 06:54

    To see default collation of the database:

    USE db_name;
    SELECT @@character_set_database, @@collation_database;
    

    To see collation of the table:

    SHOW TABLE STATUS where name like 'table_name';
    

    To see collation of the columns:

    SHOW FULL COLUMNS FROM table_name;
    

    To see the default character set of a table

    SHOW CREATE TABLE table_name;
    

提交回复
热议问题