悬而未决 – perl 程序读取数据库乱码
某系统,正常运行在服务器A,现想搬到服务器B。所有已知的环境至少大版本号都一致,大部分环境版本完全一致。
问题出现:在B上查询本地数据库一个内容是中文的varchar字段,dbi报错,如下:
1 2 3 4 |
[user@localhost]$ perl test.pl SELECT id from TABLE where name= "测试内容" limit 10 DBD::mysql::st execute failed: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=' at test.pl line 16. DBD::mysql::st fetchrow_array failed: fetch() without execute() at test.pl line 17. |
随后就围绕着这个报错开始尝试。[……]