gpt4 book ai didi

mysql - Mysql 中的数据库排序规则和字符集设置(在 Laravel 中)

转载 作者:行者123 更新时间:2023-11-29 18:20:19 25 4
gpt4 key购买 nike

我正在使用外部数据库(charset:latin1_swedish_ci,collat​​ion = latin1,MyISAM)和内部数据库(utf8mb4_unicode_ci,utf8mb4,InnoDB)。

  • customer_name : collation = utf8mb4_unicode_ci
  • customer_email : collation = utf8mb4_unicode_ci

因此每次从外部数据库获取数据时都会收到以下异常警告。

根据我的情况,我应该如何修改数据库设置?谢谢。

<小时/>

(3/3) 查询异常

SQLSTATE[HY000]:一般错误:1366 不正确的字符串值:第 1 行“customer_name”列的“\xF8peri ...”(SQL:插入 customers (idcustomer_namecustomer_email)值(10008、Olsen Naen Klist�pe AS、naen@klist.no))

<小时/>

外部数据库 enter image description here

内部数据库 enter image description here

<小时/>

测试系统:Win10(64位)、Mysql(v5.7.19、InnoDB)、PHP(v7.1)、Laravel(v5.4)

最佳答案

如果那应该是 ø,那么您需要执行以下两件事中的其中:

  • 将客户端中文本的编码从 latin1 切换为 UTF-8。

  • 告诉 MySQL 客户端正在使用 latin1 进行对话。

其他字符集调试:Trouble with UTF-8 characters; what I see is not what I stored

关于mysql - Mysql 中的数据库排序规则和字符集设置(在 Laravel 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46640891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com