Mysql(在Laravel中)DB排序规则和图表设置
问题描述:
我使用带有内部数据库(utf8mb4_unicode_ci,utf8mb4,InnoDB)的外部数据库(charset:latin1_swedish_ci,collation = latin1,MyISAM)。Mysql(在Laravel中)DB排序规则和图表设置
- customer_name : collation = utf8mb4_unicode_ci
- customer_email : collation = utf8mb4_unicode_ci
因此,每次从外部数据库获取数据时,都会收到以下异常警告。
在我的情况下,我应该如何修改数据库设置?谢谢。
(3/3)QueryException
SQLSTATE [HY000]:常规错误:错误1366字符串值: '\ xF8peri ......' 在第1行(SQL列 'CUSTOMER_NAME':插入customers
(id
,customer_name
,customer_email
)值(10008,奥尔森Naen Klistpe AS,[email protected]))
测试系统: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
Dup的https://stackoverflow.com/questions/46648829/mysql-setting-for-correct-character-and-collation-in-laravel的 –