在第1行的'■/'附近导入mysqldump文件ERROR 1064(42000)时 [英] While importing mysqldump file ERROR 1064 (42000) near ' ■/ ' at line 1

查看:60
本文介绍了在第1行的'■/'附近导入mysqldump文件ERROR 1064(42000)时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法在Windows的命令行中导入mysqldump.exe创建的以下转储文件

Cannot import the below dump file created by mysqldump.exe in command line of windows

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `attachment_types` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DESCRIPTION` varchar(50) DEFAULT NULL,
  `COMMENTS` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `UK_ATTACHMENT_TYPES___DESCRIPTION` (`DESCRIPTION`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

在命令行中导入文件

mysql --user=root --password=root < mysqldumpfile.sql

它引发错误

ERROR 1064 (42000) near ' ■/ ' at line 1

请有人帮我.

推荐答案

最后我找到了解决方法

我们需要两个选择

  • --default-character-set=utf8:这确保将UTF8用于每个 字段
  • --result-file=file.sql:此选项可防止转储数据 通过可能不会通过的操作系统 使用UTF8.而是将转储数据直接传递到文件 指定.
  • --default-character-set=utf8: This insures UTF8 is used for each field
  • --result-file=file.sql: This option prevents the dump data from passing through the Operating System which likely does not use UTF8. Instead it passes the dump data directly to the file specified.

使用这些新选项,转储命令将如下所示:

Using these new options your dump command would look something like this:

mysqldump -u root -p --default-character-set=utf8 --result-file=database1.backup.sql database1

在导入时,您可以选择使用:

While Importing you can optionally use:

mysql --user=root --password=root --default_character_set utf8 < database1.backup.sql

来源: http://nathan.rambeck.org/blog/1-preventing-encoding-issues-mysqldump

这篇关于在第1行的'■/'附近导入mysqldump文件ERROR 1064(42000)时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆