ERROR 1366 (HY000): Incorrect string value: 'xD5xC5xC8xFD' for column 'name' at(示例代
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR 1366 (HY000): Incorrect string value: 'xD5xC5xC8xFD' for column 'name' at(示例代相关的知识,希望对你有一定的参考价值。
ERROR 1366 (HY000): Incorrect string value: ‘\xD5\xC5\xC8\xFD‘ for column ‘name‘
at row 1
数据库字符集问题,查看数据库状态:
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.6.12, for Win32 (x86)
Connection id: 25
Current database: information_schema
Current user: [email protected]
SSL: Not in use
Using delimiter: ;
Server version: 5.6.12 MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: gbk
Conn. characterset: gbk
TCP port: 3306
Uptime: 8 hours 54 min 47 sec
Threads: 1 Questions: 372 Slow queries: 0 Opens: 108 Flush tables: 1 Open t
ables: 62 Queries per second avg: 0.011
--------------
我要使用的库test的字符集是latin1,该字符集不支持中文字符。
查看表引擎状态:
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
| Table | Create Table
|
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
| ttt | CREATE TABLE `ttt` (
`id` int(11) NOT NULL,
`name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
修改表字符集:
mysql> alter table ttt character set utf8;
Query OK, 0 rows affected (0.10 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
| Table | Create Table
|
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
| ttt | CREATE TABLE `ttt` (
`id` int(11) NOT NULL,
`name` varchar(20) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
修改字段字符集:
mysql> alter table ttt modify name varchar(20) character set utf8;
Query OK, 0 rows affected (1.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
| Table | Create Table
|
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
| ttt | CREATE TABLE `ttt` (
`id` int(11) NOT NULL,
`name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
1 row in set (0.02 sec)
OK!
转载出处 http://blog.sina.com.cn/s/blog_8f7940400101by3u.html
以上是关于ERROR 1366 (HY000): Incorrect string value: 'xD5xC5xC8xFD' for column 'name' at(示例代的主要内容,如果未能解决你的问题,请参考以下文章
Mysql数据库插入数据库报错, ERROR 1366 (HY000): Incorrect string value: '\xBE\xEA' for column &
关于“WARN: SQL Error: 1366, SQLState: HY000”错误的解决方案
ERROR 1366 (HY000): Incorrect string value: 'xADxE5x9BxBDxE9x82...' fo的解决方法
ERROR 1366 (HY000): Incorrect string value: 'xD5xC5xC8xFD' for column 'name' at(示例代
解决mysql插入中文字符报错的问题ERROR 1366 (HY000): Incorrect string value: ‘xE5xB0x8FxE6x98x8E‘ for column
错误 1366 (HY000):不正确的字符串值:第 1 行的列 'comment' 的 '\xF0\x9F\x98\x9C'