Mantar
Mantar

Reputation: 2720

Can't import MySQL database due to syntax error

But why? I've imported it in OS X and on another Linux machine, this one however plain refuses..

Where am I going wrong?

Output:

mysql> mysql -u root -p explore < /tmp/explore.sql;

ERROR 1064 (42000): 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 'mysql -u root -p explore < /tmp/explore.sql' at line 1

Upvotes: 4

Views: 2790

Answers (2)

Shakti Singh
Shakti Singh

Reputation: 86336

try to execute this

source /tmp/explore.sql;

after logging in mysql prompt

or

get out from the mysql prompt you are already there and run the command you are trying. Thanks

Upvotes: 1

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181270

You are trying to run a shell command from the MySQL command line interpreter. You need to run that from BASH (or any other shell), no the MYSQL command prompt.

Like this in Linux:

$ mysql -u root -p explore < /tmp/explore.sql;

Like this in Windows:

C:\> mysql -u root -p explore < c:\tmp\explore.sql;

Upvotes: 5

Related Questions