You can use system variables character_set_server to know the default server character set in MySQL. Following is the syntax −
SHOW VARIABLES LIKE 'character_set_server';
Additionally, to u can use collation_server system variable to know the default collation in MySQL. Following is the syntax −
SHOW VARIABLES LIKE 'collation_server';
Let us execute the above syntaxes to know the default character set and collation.
Following is the query −
mysql> SHOW VARIABLES LIKE 'character_set_server';
This will produce the following output −
+----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | character_set_server | utf8 | +----------------------+-------+ 1 row in set (0.25 sec)
Following is the query to know collation −
mysql> SHOW VARIABLES LIKE 'collation_server';
This will produce the following output −
+------------------+-----------------+ | Variable_name | Value | +------------------+-----------------+ | collation_server | utf8_unicode_ci | +------------------+-----------------+ 1 row in set (0.01 sec)