0

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'
);
Avi Levi
  • 11
  • 3

1 Answers1

1

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).

fancyPants
  • 50,732
  • 33
  • 89
  • 96
  • thank you all very much; I did both mistakes. i removed the quotes where the value is integer and removed the quotes from table and variables names. i made the dump with heidymysq and thats made the problem. creating the dump from command line mad it ok – Avi Levi Aug 26 '18 at 13:06