2、修改dump出来的sql文件,用Emeditor或iconv把文件的编码转换为utf-8,注意最好不要那个什么“Unicode Signature(BOM)”,因为mysql.exe不认的。再把文件中的gbk_bin替换为utf8_general_ci,把gbk替换为 utf8,然后在文件最前面加上 set names utf8.
带上BOM,mysql不识别的错误大体如下: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax. check the ma nual that corresponds to your MySQL server version for the right syntax to use n ear ‘??? /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */’ at line 1
3、重新建mysql库,然后导入备份的sql语句,导入命令如下: mysql -u -p database < dumpdata.sql
4、如果是以前导出的文件,导入的时候遇到错误: Got a packet bigger than ‘max_allowed_packet’ bytes or ERROR 1153 (08S01) at line 616: Got a packet bigger than ‘max_allowed_packet’ by tes