简体   繁体   English

MySQL:“ \\。”不起作用?

[英]Mysql: “\.” doesn't work?

I was trying to upload an .sql file to mysql console with \\. 我试图用\\..sql文件上传到mysql控制台\\. but it throwed me: 但是它把我扔了:

mysql> \.  /home/krest/s.sql;
ERROR: 
Failed to open file '/home/krest/s.sql;', error: 2

However, "source" command works properly! 但是,“源”命令可以正常工作!

What I am doing wrong? 我做错了什么?

I am running console through ubuntu 14.04 terminal. 我正在通过ubuntu 14.04终端运行控制台。

Look closer to the error message, everything you need to know is there: 仔细查看错误消息,您需要了解的所有信息都在其中:

Failed to open file '/home/krest/s.sql;', error: 2

Error 2 is "No such file or directory". 错误2是“没有这样的文件或目录”。 You can use the perror command line tool to find out the message from an error code returned by MySQL. 您可以使用perror命令行工具从MySQL返回的错误代码中查找消息。

Did you figure out what's wrong? 你知道出什么事了吗? The semicolon after the file name is not supposed to be there. 文件名后的分号不应存在。 MySQL thinks it is part of the file name and this is why it cannot find the file. MySQL认为它是文件名的一部分,这就是为什么它找不到文件的原因。

As a side note, it seems that some of the short commands work if the ending semicolon is preceded by a space and do not work without the space ( \\u\u003c/code> , for example, works this way). 附带说明一下,似乎某些短命令如果在结尾的分号前面加一个空格,并且在没有空格的情况下不起作用(例如\\u\u003c/code>可以这样)。 Others take everything until the end of line as parameter (and fail with an error because of the ending semicolon). 其他人则将所有内容,直到行尾作为参数(由于分号结尾而失败,并显示错误)。

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

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