SHOWCREATEDATABASEweb; this will produce the following output while displaying the default character set -+----------+------------ -------------------------------------------------- --------------------------+|Database|CreateDatabase &n"/> SHOWCREATEDATABASEweb; this will produce the following output while displaying the default character set -+----------+------------ -------------------------------------------------- --------------------------+|Database|CreateDatabase &n">

Home  >  Article  >  Database  >  Determine what the character set of the MySQL database is set to

Determine what the character set of the MySQL database is set to

WBOY
WBOYforward
2023-08-31 10:05:021259browse

确定 MySQL 数据库的字符集设置为什么

Assuming we are creating a database "network" -

mysql> SHOW CREATE DATABASE web;

This will produce the following output while displaying the default character set -

+----------+-----------------------------------------------------------------------------------------+
| Database | Create Database                                                                         |
+----------+-----------------------------------------------------------------------------------------+
| web      | CREATE DATABASE `web` /*!40100 DEFAULT CHARACTER SET utf8 COLLATEutf8_unicode_ci */     | 
+----------+-----------------------------------------------------------------------------------------+
1 row in set (0.03 sec)

If you To find out the character set of a specific table in the database, use the following query. Here, assume we have a table named DemoTable in database "web" -

mysql> SHOW CREATE table web.DemoTable;

This will produce the following output showing the character set -

+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| 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)

The above is the detailed content of Determine what the character set of the MySQL database is set to. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete