MySQL中字段输入中文报错

情况如图:
correct string value: '\xE8\xB6\x85\xE7\xBA\xA7...' for column 'product_description' at row 1
解决方法:
1.执行 SHOW VARIABLES LIKE "%char%";命令,查看编码格式
correct string value: '\xE8\xB6\x85\xE7\xBA\xA7...' for column 'product_description' at row 1
2. 如果 character_set_database 格式不对,则需要执行 set character_set_database=utf8; 命令,将其编码格式改为utf8,更改后如图:
correct string value: '\xE8\xB6\x85\xE7\xBA\xA7...' for column 'product_description' at row 1
3.执行 show create table 你的表名; 查看表数据库引擎的编码方式是否正确,如果charset为latin1的话,还需要执行 ALTER TABLE 你的表名 CHARSET=utf8; 将charset改为utf8

4. 执行 ALTER TABLE你的表名CHANGE你的列名你的列名VARCHAR(64) CHARACTER SET utf8; 命令设置字段编码,然后就okk啦

相关文章:

  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
猜你喜欢
  • 2021-07-31
  • 2021-09-22
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
相关资源
相似解决方案