用户标记后的mysql连接空格 [英] mysql connection whitespace after user flag

查看:103
本文介绍了用户标记后的mysql连接空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,在mysql连接字符串中用户标记 -u 后,空白的意义是什么?

I have a question, What is the significance of the whitespace after the user flag -u inside a mysql connection string?

mysql -u myname -pmypass mydb

我的意思是说,如果我在 -u 之后不传递空格,并且上面的命令写为:

I mean to say, the above command works just fine, if I don't pass a whitespace after -u and just write the above command as below.

mysql -umyname -pmypass mydb

我尝试使用以下搜索词来搜索解释。

I tried searching for an explaination by using the following search terms.


  • 用户标记后的mysql登录空白

  • 用户标记后的mysql连接控制台空白

  • mysql login whitespace after user flag
  • mysql connection console whitespace after user flag

我在密码标志 -p 此处。但是在用户标记 -u 之后,没有页面讨论空白。

I found the mention of whitespace after the password flag -p, Here. But the page no where talks about the whitespace after the user flag -u.


.... -p或--password =与后面的密码之间必须没有空格。

....there must be no space between -p or --password= and the password following it.


推荐答案

-p 选项采用可选参数:

mysql --help --verbose
...
  -p, --password[=name]
  Password to use when connecting to server. If password is
  not given it's asked from the tty.

因此,包含以下内容的命令行:

So, a command line that contains:

-p mydb

会模棱两可...这意味着:

would be ambiguous ... does this means to:


  • 提示用户输入密码,并使用 mydb 数据库?

  • 使用密码 mydb ,而不设置默认数据库?

  • Prompt the user for a password, and use the mydb database ?
  • Use the password mydb, and not set a default database ?

这就是为什么文档坚持密码选项的特定规则的原因:该值必须附加(无空格)。

This is why the documentation insists on a particular rule for the password option: the value, if given, must be attached (no space).

对于始终带有参数的选项(例如 -u ),没有特殊考虑,因此空格并不重要。

For options that always take an argument, like -u, there are no special considerations, so the white space is not significant.

有关命令行选项的完整文档,请参见手册:

See the manual for a full documentation of command line options:

http://dev.mysql.com/doc/refman/5.7/en/command-line-options.html

这篇关于用户标记后的mysql连接空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆