Mysql中的数据库排序规则和图表集设置(在Laravel中) [英] DB collation and chartset setting in Mysql (in Laravel)
问题描述
我正在使用外部DB(charset:latin1_swedish_ci,collation = latin1,MyISAM)和内部DB(utf8mb4_unicode_ci,utf8mb4,InnoDB).
I am using external DB(charset:latin1_swedish_ci, collation=latin1, MyISAM) with internal DB(utf8mb4_unicode_ci, utf8mb4, InnoDB).
- customer_name:整理= utf8mb4_unicode_ci
- customer_email:整理= utf8mb4_unicode_ci
- customer_name : collation = utf8mb4_unicode_ci
- customer_email : collation = utf8mb4_unicode_ci
因此,每次从外部数据库获取数据时,我都会收到以下异常警告.
So everytime I get the below exception warning when getting data from external DB.
如何根据自己的情况修改数据库设置?谢谢.
How should I modify DB setting in my situation? Thanks.
(3/3)QueryException
SQLSTATE [HY000]:常规错误:1366错误的字符串值:'\ xF8peri ...'为第1行的'customer_name'列(SQL:插入customers
(id
,customer_name
,
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF8peri ...' for column 'customer_name' at row 1 (SQL: insert into customers
(id
, customer_name
, customer_email
) values (10008, Olsen Naen Klist�pe AS, naen@klist.no))
外部数据库
内部数据库
测试系统:Win10(64位),Mysql(v5.7.19,InnoDB),PHP(v7.1),Laravel(v5.4)
推荐答案
如果应该是ø
,则您需要做以下两件事之一:
If that was supposed to be ø
, then you need do one of two things:
-
将客户端中文本的编码从latin1切换为UTF-8.
Switch the encoding of text in the client from latin1 to UTF-8.
告诉MySQL客户正在latin1中进行会话.
Tell MySQL that the client is conversing in latin1.
其他字符集调试:问题具有UTF-8字符;我看到的不是我存储的内容
这篇关于Mysql中的数据库排序规则和图表集设置(在Laravel中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!