Home > Database > Mysql Tutorial > body text

mysql unknown command ‘”‘问题解决办法

WBOY
Release: 2016-06-07 17:51:13
Original
3232 people have browsed it

原来的服务器环境使用的windows,然后使用mysqldump备份出来的数据库怎么也不能在linux下的数据库中导入。导入的时候总是出现:

unknown command ‘”‘

于是将 ’ 全部替换成 ‘  结果还是不行,导入不了。

但是直接将文件copy过去就可以用的。copy过去后在dump出来。结果还是一样的效果

unknown command ‘”‘

郁闷至极。

经过多是导出导入发现,原来默认安装的使用的是utf8编码,而我本机安装的是mysql gbk数据库。这样一来,备份文件恢复的时候可能就出现了格式错误。

后来在dump的时候指定字符集 mysqldump加个参数: -default-character-set=gbk,再次导入备份文件,一切顺利。

mysqldump -u root -p  –opt –allow-keywords –default-character-set=gbk databases > /PATH/XXX.sql

非默认字符集,在导入导出注意指定相应的字符集

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!