Search code examples
mysqlimportdump

import database from dump fail


I try to import a dump file i created on one site (windows using heidiSQL export) to another site (centos 7 on commandline).

I wrote : mysql -u [username] -p [db name] < dumpfile.sql

I get an error 1064 ("you have an error in your SQL syntax")

i removed the bracket from the in defaults but still it doesnt work The content of my sql file is:

CREATE TABLE IF NOT EXISTS 'ad' (
  'id' int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  'name' char(50) NOT NULL,
  'server' char(50) NOT NULL,
  'domain' char(50) NOT NULL,
  'port' int(11) NOT NULL DEFAULT 389,
  'isssl' tinyint(4) NOT NULL DEFAULT 1,
  'uid' int(11) NOT NULL DEFAULT 0,
  'pass' char(50) NOT NULL DEFAULT '0'
);

Solution

  • How did you create the dump? It's wrong because it uses single-quotes around table names and column names. Single-quotes are used for strings. Either remove them or replace them with backticks (backticks are only needed, when you use weird characters or use keywords).