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

MySQLMySQLi Database

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)
raja
Published on 01-Apr-2019 07:51:40
Advertisements