Restore MySQL DB with Unicode characters (Arabic and Kurdish) in .gz format

懵懂的女人 提交于 2019-11-28 11:50:27

This is a fairly common problem caused by inconsistent encoding schemes when creating and exporting the database. Here is the simplest way to solve it:

  1. Import your backup file
  2. Export it again, but using latin1 encoding
  3. Manually edit the exported file, change all occurrences of latin1 to utf8.
  4. Import the edited file.
Yves Geunes

I added the lines

character-set-server=utf8
collation-server=utf8_general_ci

to the mysqld section of /etc/mysql/my.cnf on my new server, then exported the data using

mysqldump oldDB --default-character-set=latin1 -r dbCopy.sql

and imported it into the new DB using

mysql> SOURCE dbCopy.sql. Worked like a charm...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!