[英]When connecting using the mysql cli, why is there no space between -p and the password? e.g. -ppassword
mysql -hhost -uuser -ppassword
Is there a rationale behind why there's no need for spaces?为什么不需要空格的背后有什么理由吗? In fact, it wouldn't work unless there is no space.
事实上,除非没有空间,否则它不会工作。
Found my answer:找到我的答案:
https://dev.mysql.com/doc/refman/5.7/en/command-line-options.html https://dev.mysql.com/doc/refman/5.7/en/command-line-options.html
It's just the way they wrote it.这只是他们写的方式。
If you use a command like如果您使用类似的命令
mysql -h hostname -u username -p xxx
the command is ambiguous.命令不明确。 It could mean that
xxx
is the password and no database was specified, or it could mean that xxx
is the database and no password was specified (in which case mysql
prompts for a password).这可能意味着
xxx
是密码并且没有指定数据库,或者可能意味着xxx
是数据库并且没有指定密码(在这种情况下mysql
提示输入密码)。
They chose the second interpretation.他们选择了第二种解释。 But if you use
-pxxx
then xxx
can only be interpreted as the password.但是如果你使用
-pxxx
那么xxx
只能被解释为密码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.