Syntax error MySQL query to discover current default database collation (via command line client)?

MySQL query to discover current default database collation (via command line client)?



You need to use INFORMATION_SCHEMA.SCHEMATA for current default database collation.

The syntax is as follows

SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = 'yourDatabaseName' LIMIT 1;

Let us implement the above syntax to discover current default database collation (via command line client). Our database here is ‘sample’.

The query is as follows −

mysql> SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = 'sample' LIMIT 1;

The following is the output

+------------------------+
| DEFAULT_COLLATION_NAME |
+------------------------+
| utf8_general_ci        |
+------------------------+
1 row in set (0.00 sec)
Updated on: 2019-07-30T22:30:25+05:30

315 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements