Host slave1 has ip address 192.0.2.10. Host slave2 has ip address 203.0.113.50 Examine these commands: shell>mysql_config_editor print --all [slave1] host = slave1.exampleddomain.com user = robert [slave2] host = slave2.exampleddomain.com user = karen shell>mysql --login-path=slave1 --host=192.0.2.10 --user=robert -p Enter password: ERROR 1045 (28000): Access Denied for user 'robert'@'192.0.2.10' (using password: YES) Why did this error occur? A. The host on the command line is not defined in the login path. B. The mysqld instance has not been restarted after creating the login path. C. There is no password defined in the login path. D. The DNS is not configured correctly for slave1 host. E. The mylogin.cnf file is not readable.
复制
答案:c(X),个人认为应该没有正确答案,报错原因就是输入了错误的密码。
解析:mysql客户端使用mysql_config_editor配置连接时,mysql_config_editor配置优先级高于命令行默认参数,低于明确指定的参数。题中连接时明确指定了–host,–user,-p参数的值,因此实际连接时均是使用明确指定的值。C选项说原因是在login path中没有定义password,但参数中指定了-p的值的情况下,会使用明确指定的值,只要输入正确的密码是可以登陆的,如果不输入密码,报错的最后,using password应该是NO
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。