什么是(默认的)字符集:
MySQL数据库 MySQL表 MySQL列
什么是(默认的)字符集:
MySQL数据库 MySQL表 MySQL列
当前回答
数据库:
USE your_database_name;
show variables like "character_set_database";
-- or:
-- show variables like "collation_database";
参考本页。查阅MySQL手册
其他回答
我总是看SHOW CREATE TABLE mydatabase。mytable。
对于数据库,似乎需要查看SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA。
数据库:
只需使用这些命令:
USE db_name;
SELECT @@character_set_database;
-- or:
-- SELECT @@collation_database;
在创建新数据库时,将生成一些必要的表
在“information_schema”中此路径
“列”——>关于列
“表”——>表
例如,如果您需要查看表中的所有列名和类型
SELECT COLUMN_NAME,COLUMN_TYPE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'your_schema_name' AND TABLE_NAME = 'your_table_name'
要查看数据库的默认排序规则:
USE db_name;
SELECT @@character_set_database, @@collation_database;
要查看表格的排序:
SHOW TABLE STATUS where name like 'table_name';
要查看列的排序规则:
SHOW FULL COLUMNS FROM table_name;
查看表的默认字符集
SHOW CREATE TABLE table_name;
数据库:
SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA;
示例输出:
mysql> SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA;
+----------------------------+---------+--------------------+
| database | charset | collation |
+----------------------------+---------+--------------------+
| information_schema | utf8 | utf8_general_ci |
| drupal_demo1 | utf8 | utf8_general_ci |
| drupal_demo2 | utf8 | utf8_general_ci |
| drupal_demo3 | utf8 | utf8_general_ci |
| drupal_demo4 | utf8 | utf8_general_ci |
| drupal_demo5 | latin1 | latin1_swedish_ci |
...
+----------------------------+---------+--------------------+
55 rows in set (0.00 sec)
mysql>