mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-25 04:17:17 +00:00
19 lines
442 B
Markdown
19 lines
442 B
Markdown
# PHP、Mysql 乱码
|
|
|
|
|
|
- 查看 Mysql 数据表字符编码
|
|
- 查看表字段编码
|
|
- 查看 PDO 连接编码
|
|
- 查看 Mysql 数据库服务器编码
|
|
|
|
这次吃亏就是在 Mysql 数据库服务器编码导致。
|
|
|
|
- 查看数据库服务器编码
|
|
```SQL
|
|
show variables like 'character%';
|
|
```
|
|
|
|
所以知道其他编码都正常,问题定位到数据库服务器编码问题。
|
|
- vim /etc/my.cnf
|
|
- character-set-server=utf8
|
|
- 重启服务器 |