Copying a mysql database generates “ERROR: unknown command” when importing

旧巷老猫 提交于 2019-12-08 14:21:34
mysql --default-character-set=utf8 db < dump.sql

You can add this argument --default-character-set=utf8 in the command:

mysql -u USERNAME -p my_database --default-character-set=utf8 < "C:/My Document Names Have Spaces/my_dump.sql"

I've finally found this solution and it works fine with my new installed WampServer 2.5. I've also tried to add the default character setting in my.ini, but it's useless. Until I've tried the above argument added in my DOS batch file.

My batch file execute the command, like this way: 7zip x -so %1.%2.7z|%mysql% -uxxxx -pyyyyy %2 --default-character-set=utf8

For example, the 7zip filename is 20141231.google.7z, which contains "google.sql", and the database name is google

My backup process on Linux system was a 7zip compressed. In Winodws, I used an automatic batch file to restore the same contents, so that I can share the same database in my biz trip and work offline from the server.

Hope this method is helpful to you.

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