can not run a sql file windows command line using SOURCE command
Solution 1
My original answer:
mysql> SOURCE C:\\xampp\\htdocs\\elephanti2\\db\\mas_gis_city_ip.sql;
You could also try executing the command like this:
mysql> SOURCE C:/xampp/htdocs/elephanti2/db/mas_gis_city_ip.sql;
(Source: a comment in the reference manual suggests using forward slashes on Windows machines)
Solution 2
Actually this worked. I think it is dwuff's previous answer.
mysql> SOURCE C:\\xampp\\htdocs\\elephanti2\\db\\mas_gis_city_ip.sql;
Solution 3
Try quoting your file name. Notice your command:
mysql> SOURCE C:\xampp\htdocs...
is probably being interpreted as:
mysql SOURCE C: \xampp \htdocs...
(see the \x there?)
If you quote the file name, I bet it'll work. (not sure if mysql requires ' or " for quoting filenames in this context, try both)
Solution 4
I had the same problem recently trying to install FossTrak, and this was the syntax that worked on windows 10, with Mysql 5.7
\. C:/share/epcis-repository-0.5.0/epcis_schema.sql
using \source
did not, and neither did \\
, and by accident i removed the ;
and it worked.
Comments
-
Kanishka Panamaldeniya almost 2 years
hi i am using
windows 7, xampp
. i am trying to run a
sql
file usingCMD
ut it gives me an errorERROR: Unknown command '\x'.
this is what i am doing
this command is not working
mysql> SOURCE C:\xampp\htdocs\elephanti2\db\mas_gis_city_ip.sql;
*** one other problem with this works fine when i tried by go to
phpmyadmin
and import the file .why this happening , i have no idea , please help ..................
-
Simon East about 7 yearsYep, and remember not to include quotes around the path, which also tripped me up.
-
Frank Forte about 5 yearsStrange enough, I had to remove the semi-colon to get it working.