ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1
生活随笔
收集整理的這篇文章主要介紹了
ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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: ??????????root@localhost 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?
轉載于:https://www.cnblogs.com/seven-ahz/p/7083372.html
總結
以上是生活随笔為你收集整理的ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 玻璃栈道门票多少钱
- 下一篇: IDEA IntelliJ/ Data