简体   繁体   中英

can not run a sql file windows command line using SOURCE command

hi i am using windows 7, xampp

. i am trying to run a sql file using CMD ut it gives me an error

ERROR:
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 ..................

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)

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)

Actually this worked. I think it is dwuff's previous answer.

mysql> SOURCE C:\\xampp\\htdocs\\elephanti2\\db\\mas_gis_city_ip.sql;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM