暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

MySQL 5.7OCP第十一题 关于mysql_config_editor的配置;

原创 岳彩磊 2023-02-03
348

11、mysql-config_editor C There is no password defined in login path

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.exampledomain.com
user=root
[slave2]
host = slave2.exampledomain.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;
Answer:C;
mysql_config_editor 出现在 mysql5.6.6 以后的版本, 可以给指定的连接和密码生成一个加密文件.mylogin.cnf, 默认位于当前用户家目录下。 通过该文件可以使用 mysql、 mysqladmin 等直接登录, 避免明文密码出现在脚本中。配置好后的查询命令是:
[root@mysql57 ~]# mysql_config_editor set --user=root --password --host=localhost
Enter password:
[root@mysql57 ~]# mysql_config_editor print --all
[client]
user = root
password = *****
host = localhost
原题打印的缺失 password,表明没有录入密码, 但是有-p, 密码输入对了也是可以登录的;

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论