简体   繁体   English

无法使用SOURCE命令运行sql文件的Windows命令行

[英]can not run a sql file windows command line using SOURCE command

hi i am using windows 7, xampp 你好我在使用windows 7, xampp

. i am trying to run a sql file using CMD ut it gives me an error 我试图使用CMD运行一个sql文件,它给了我一个错误

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 . ***当我尝试去phpmyadmin并导入文件时,这个问题的另一个问题很好。

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) (来源: 参考手册中的评论建议在Windows机器上使用正斜杠)

Try quoting your file name. 尝试引用您的文件名。 Notice your command: 注意你的命令:

mysql> SOURCE C:\\xampp\\htdocs... mysql> SOURCE C:\\ xampp \\ htdocs ...

is probably being interpreted as: 可能被解释为:

mysql SOURCE C: \\xampp \\htdocs... mysql SOURCE C:\\ xampp \\ htdocs ...

(see the \\x there?) (参见\\ x那里?)

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) (不确定mysql是否需要'或'来引用此上下文中的文件名,请尝试两者)

Actually this worked. 实际上这很有效。 I think it is dwuff's previous answer. 我认为这是dwuff之前的回答。

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 我最近尝试安装FossTrak时遇到了同样的问题,这就是使用Mysql 5.7在Windows 10上运行的语法

\\. C:/share/epcis-repository-0.5.0/epcis_schema.sql

using \\source did not, and neither did \\\\ , and by accident i removed the ; 使用\\source没有,也没有\\\\ ,并且偶然我删除了; and it worked. 它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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