
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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)
- Related Articles
- The MySQL Command-Line Client
- MySQL command line client for Windows?
- Connect to MySQL database from command line
- Connecting to MySQL database from the command line?
- How to create a database on command line in MySQL?
- How to see spaces in data when selecting with MySQL command line client?
- Show MySQL host via SQL Command?
- Best Command Line HTTP Client for Linux
- Interactive plotting with Python Matplotlib via command line
- How to convert an MySQL database characterset and collation to UTF-8?
- Rainbow Stream – An Advanced Command-line Twitter Client for Linux
- How can we change the default MySQL database to the given database?
- Insert current date to the database in MySQL?
- MySQL query to get current datetime and only current date
- Oracle DataBase – Grant Privileges to a User in SQL Command Line

Advertisements