解决网站迁移之后,中文路径都变成乱码
一般都是数据库格式造成
进入数据库查看
mysql> show variables like '%char%';
+--------------------------------------+----------------------------+
| Variable_name | Value |
+--------------------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| validate_password_special_char_count | 1 |
vim /etc/my.cnf
[mysqld]
character-set-server=utf8
修改完成后重启
systemctl restart mysqld
可以看到原本乱码的路径
http://192.168.1.1/u/[小蓓��E]
已恢复
http://192.168.1.1/u/小蓓蕾