在 Mysql 5.7 中导入 MySql 转储时出错 [英] Error while importing MySql dump in Mysql 5.7

查看:38
本文介绍了在 Mysql 5.7 中导入 MySql 转储时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在导入数据库时​​遇到一些错误.

We are facing some errors while importing DB.

CREATE TABLE `pf_class_room` (
  `id` int(11) NOT NULL,
  `class_name` varchar(500) DEFAULT NULL,
  `class_min_limit` int(11) DEFAULT '0',
  `class_max_limit` int(11) NOT NULL,
  `class_from_date` date DEFAULT NULL,
  `class_from_time` time DEFAULT NULL,
  `class_to_date` date DEFAULT NULL,
  `class_to_time` time DEFAULT NULL,
  `class_address` varchar(1000) DEFAULT NULL,
  `class_country` varchar(50) DEFAULT NULL,
  `class_city` varchar(50) DEFAULT NULL,
  `class_pin` varchar(10) DEFAULT NULL,
  `class_course` int(11) DEFAULT NULL,
  `class_trainer` int(11) DEFAULT NULL,
  `cost` int(11) NOT NULL,
  `costformat` varchar(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0'COMMENT
)
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 19

这里我们删除了 COMMENT 并导入了脚本.

Here we have removed COMMENT and imported script.

我们也有类似的错误:

2 errors were found during analysis.

Ending quote ' was expected. (near "" at position 15650)
7 values were expected, but found 6. (near "(" at position 15576)

在其中一个创建表定义

`future_courses` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT AS `Scope or Eligibility for certain courses in the future`,

出现类似

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `Scope or Eligibility for certain courses in the future`,

我们在 COMMENT、单引号等附近遇到错误.这似乎是导出或导入的一些问题.我们有160多张桌子.所以这种错误一再影响我们.有什么解决办法吗?

We are facing error near COMMENT, single quotes etc. It looks like some problem with export or import. We have more than 160 table. So this kind of error repeatedly effecting us. Any solution for this?

推荐答案

我找到了解决方案.

我使用 phpmyadmin 导入/导出.所以我们面临着这些问题.

I was importing/exporting using phpmyadmin. So we were facing these issues.

现在我们尝试使用命令行,一切正常,没有任何问题.

Now we tried with commandline and everything works fine without any trouble.

用于导出:

mysqldump -u username -p databasename > filename.sql

用于导入:

mysql -u username -p databasename < filename.sql

这篇关于在 Mysql 5.7 中导入 MySql 转储时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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