Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import MySQL database due to syntax error

Tags:

linux

mysql

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

like image 259
Mantar Avatar asked Sep 03 '25 05:09

Mantar


1 Answers

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;
like image 111
Pablo Santa Cruz Avatar answered Sep 04 '25 19:09

Pablo Santa Cruz