MySQL中文_MySQL
1. 数据库表中字段的字符集设置 。show create table TableName 或 show full columns from tableName
mysql> show create table t1;
+-------+------------------------------------
| Table | Create Table
+-------+------------------------------------
| t1 | CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`c1` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+-------+------------------------------------
1 row in set (0.00 sec)
mysql> show full columns from t1;
+-------+-------------+----------------+------+-----+-
| Field | Type | Collation | Null | Key |
+-------+-------------+----------------+------+-----+-
| id | int(11) | NULL | NO | PRI |
| c1 | varchar(30) | gbk_chinese_ci | YES | |
+-------+-------------+----------------+------+-----+-
2 rows in set (0.00 sec)
mysql>
2. 当前联接系统参数 show variables like 'char%'
mysql> show variables like 'char%';
+--------------------------+----------------
| Variable_name | Value
+--------------------------+----------------
| character_set_client | gbk
| character_set_connection | gbk
| character_set_database | latin1
| character_set_filesystem | binary
| character_set_results | gbk
| character_set_server | latin1
| character_set_system | utf8
| character_sets_dir | C:/Program File
+--------------------------+----------------
8 rows in set (0.00 sec)
mysql>
a. 中文,请确保 表中该字段的字符集为中文兼容:
big5 | Big5 Traditional Chinese
gb2312 | GB2312 Simplified Chinese
gbk | GBK Simplified Chinese
utf8 | UTF-8 Unicode
b. 确保,联接参数与这个字段字符集一致,你可以用 set name 'charsetname';
比如, set name 'gbk';
这条命令会同时修改 character_set_client,character_set_connection,character_set_results
(如果你的这架MySQL中都为中文,则你可以在my.ini或my.cnf中加上或修改这个参数, 参数文件修改后需重启MySQL服务)
[mysql]
default-character-set=utf8;
作者“wingware”
推荐阅读
-
MySQL5.7完全卸载步骤详解
-
概述MySQL统计信息
-
mysql 5.7以上版本安装配置方法图文教程(mysql 5.7.12mysql 5.7.13mysql 5.7.14)
-
Wing FTP Server FTP服务器端中文版安装使用教程
-
MySQL常见内存不足启动失败的完美解决方法
-
随机生成八位优惠码并保存至Mysql数据库
-
Mysql5.7中使用group concat函数数据被截断的问题完美解决方法
-
Mysql5.7.17 winx64.zip解压缩版安装配置图文教程
-
MySQL SQL语句分析与查询优化详解
-
Windows 64 位 mysql 5.7以上版本包解压中没有data目录和my-default.ini及服务无法启动的快速解决办法(问题小结)