stefun
stefun

Reputation: 1551

Error while importing MySql dump in Mysql 5.7

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

Here we have removed COMMENT and imported script.

We also got error like :

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)

In one of the create table definition

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

Got error like

#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`,

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?

Upvotes: 0

Views: 1676

Answers (2)

Isaac Bennetch
Isaac Bennetch

Reputation: 12422

There was a phpMyAdmin version where a bug occurred when exporting certain tables (notably in this case, when the tables had a comment). I suggest that you upgrade to the latest version which fixes this bug.

Upvotes: 0

stefun
stefun

Reputation: 1551

I got the solution.

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

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

Use this for export:

mysqldump -u username -p databasename > filename.sql

Use this for import:

mysql -u username -p databasename < filename.sql

Upvotes: 1

Related Questions