mysql密码命令行选项--pasword="”失败,但-p提示符成功?

zed5wv10  于 2022-12-17  发布在  Mysql
关注(0)|答案(1)|浏览(136)

抓我的头在这一个。
我可以使用-p选项连接到mysql进行密码验证

kevzettler@kevs-mbp-3 radcade-wordpress % mysql -h localhost -P 3306 --protocol=tcp -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.7.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye

然而,当我尝试使用扩展的-password选项时,它总是被拒绝访问。

kevzettler@kevs-mbp-3 radcade-wordpress % mysql -h localhost -P 3306 --protocol=tcp -u root -password='password'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'172.24.0.1' (using password: YES)

是否存在拒绝命令行密码的隐藏安全选项?

qv7cva1a

qv7cva1a1#

long选项必须以两个破折号为前缀。
就像这样:

--password='xyzzy'

不是这样的:

-password='xyzzy'

对于一个选项,它就是-p短选项,后跟密码字符串assword=xyzzy
在MySQL中,短-p选项不要求在选项字符和密码字符串之间有空格,这是因为-p后面跟空格表示交互式地提示输入密码。

相关问题