2. 登录另一个实例数据库,修改上述三个文件的权限,并修改root密码
mysql> select user,host,password from test.user;+------+-----------+-------------------------------------------+| user | host | password |+------+-----------+-------------------------------------------+| root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |+------+-----------+-------------------------------------------+1 row in set (0.00 sec)mysql> update test.user set password=password("hello") where user="root" and host="localhost";Query OK, 1 row affected (0.15 sec)Rows matched: 1 Changed: 1 Warnings: 03. 将上述三个文件copy回源数据库
4. 获取mysqld的pid,通过kill -HUP `pidof mysqld`方式让mysqld进程重新加载配置文件
[root@keepalived01 ~]# mysql -phelloWarning: Using a password on the command line interface can be insecure.ERROR 1045 (28000): Access denied for user "root"@"localhost" (using password: YES)[root@keepalived01 ~]# kill -HUP 4283[root@keepalived01 ~]# mysql -phelloWarning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 2528Server version: 5.6.26 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type "help;" or "h" for help. Type "c" to clear the current input statement.mysql>通过上述输出可以看出,kill -HUP之前,直接用密码hello登录被拒绝,kill -HUP之后,就可以直接登录了。