- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Determine what a MySQL DB’s charset is set to
Let’s say we are creating a database “web” −
mysql> SHOW CREATE DATABASE web;
This will produce the following output displaying the default charset as well −
+----------+-----------------------------------------------------------------------------------------+ | Database | Create Database | +----------+-----------------------------------------------------------------------------------------+ | web | CREATE DATABASE `web` /*!40100 DEFAULT CHARACTER SET utf8 COLLATEutf8_unicode_ci */ | +----------+-----------------------------------------------------------------------------------------+ 1 row in set (0.03 sec)
If you want to know the charset for a particular table from a databse, then use the below query. Here, let’s say we have a table with name DemoTable in the database “web” −
mysql> SHOW CREATE table web.DemoTable;
This will produce the following output displaying the charset −
+--------------+----------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------------+----------------------------------------------------------------------------------------------------------------------------------+ | DemoTable | CREATE TABLE `DemoTable` (`Value` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | +--------------+----------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
Advertisements