Description:
mysql doesn't show what collation was used sometimes if that collation is the default.
It seems that Bug #46239 is not fixed totally.
How to repeat:
Here is the repeat step. Both latin1_swedish_ci and utf8mb4_0900_ai_ci are default collate.
But utf8mb4_0900_ai_ci is shown, latin1_swedish_ci is not shown.
mysql> create table t1(i int) COLLATE=latin1_swedish_ci;
Query OK, 0 rows affected (0.01 sec)
mysql> create table t2(i int) COLLATE=utf8mb4_0900_ai_ci;
Query OK, 0 rows affected (0.01 sec)
mysql> show create table t1;
+-------+-----------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------+
| t1 | CREATE TABLE `t1` (
`i` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show create table t2;
+-------+---------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------------------------------+
| t2 | CREATE TABLE `t2` (
`i` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+---------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Suggested fix:
Always show the collate of table.