Home > Database > Mysql Tutorial > 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
Release: 2023-08-31 10:05:02
forward
1314 people have browsed it

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

Assuming we are creating a database "network" -

mysql> SHOW CREATE DATABASE web;
Copy after login

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)
Copy after login

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;
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template