relay.index' not found

时间:2023-05-20 08:53:38

主备搭建时,备库上执行以下语句报错:

(root@localhost:mysql.sock)[(none)]>change master to master_host='192.168.0.57',
    -> master_user='rep1',
    -> master_password='wqq',
    -> master_log_file='binlog.000001',
    -> master_log_pos=0;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: *** NONE ***

ERROR 29 (HY000): File '/data/mysql/relay_log/relay.index' not found (Errcode: 2 - No such file or directory)

解决办法:

创建相应目录及relay-log.index

[root@upright etc]# cd /data/mysql/

[root@upright mysql]# mkdir relay_log

[root@upright mysql]# cd relay_log/

[root@upright relay_log]# vi relay-log.index

[root@upright relay_log]# cd ..

[root@upright mysql]# chown mysql:mysql  relay_log -R

(root@localhost:mysql.sock)[(none)]>change master to master_host='192.168.0.57',
    -> master_user='rep1',
    -> master_password='wqq',
    -> master_log_file='binlog.000001',
    -> master_log_pos=0;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: *** NONE ***

Query OK, 0 rows affected, 2 warnings (0.05 sec)