免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年5月8日 星期五

mysql, how to clear master.info


https://dev.mysql.com/doc/refman/5.0/en/reset-slave.html
"""...
RESET SLAVE makes the slave forget its replication position in the master's binary log.
This statement is meant to be used for a clean start:
It deletes the master.info and relay-log.info files,
all the relay log files, and starts a new relay log file.
To use RESET SLAVE, the slave replication threads must be stopped ...
..."""


$ sudo cat /var/lib/mysql/master.info
"""
23
mysql-bin-changelog.012909
120
mysql1.chswwb1olfin.us-west-2.rds.amazonaws.com
repl_u13
pass_u13
3306
60
0
...
0
1800.000
...
0
"""

$ mysql -uroot -p
mysql> reset slave;
mysql > exit

$ sudo cat /var/lib/mysql/master.info
[sudo] password for u13:
cat: /var/lib/mysql/master.info: No such file or directory


//===
mysql> \! nano ~/change_master_to.sql
mysql> source ~/change_master_to.sql
Query OK, 0 rows affected, 2 warnings (0.65 sec)

mysql> show warnings;

| Note | 1759 | Sending passwords in plain text without SSL/TLS is extremely insecure. |
| Note | 1760 | Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. |

mysql> start slave password='pass_u13'


mysql> show slave staus \G;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'staus' at line 1


--> typo error
mysql> show slave status \G;
"""...
1593 Last_IO_Error: Fatal error: Invalid (empty) username when attempting to connect to the master server. Connection attempt terminated.
..."""


-->
mysql> start slave user='repl_u13' password='pass_u13'


mysql> \! sudo cat /var/lib/mysql/master.info

[Q] why is master_password different from that in "start slave ... " ???

[Q] after reset slave and source the new change_master_to.sql,
master.info still shows the wrong password?


沒有留言:

張貼留言