I had setup mysql replication using percona Xtrabackup. Replication was from my web server to my local machine. It used to work but my ISP changed IP address and replication stopped working. I'm getting this error:
mysql> SHOW REPLICA STATUS\G
*************************** 1. row ***************************
......
Replica_IO_State: Connecting to source
....
....
Last_IO_Errno: 1045
Last_IO_Error: Error connecting to source '[email protected]:1234'. This was attempt 29/86400, with a delay of 60 seconds between attempts. Message: Access denied for user 'repl'@'hostname' (using password: YES)
I can connect to source from replica via command line and access source's db via show database and use database commands
mysql --host=x.x.x.x --user=repl --password='pwd';
On Master
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000081 | 75494370 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
I'm not able to figure out what is wrong with replication? How to find out issue and fix it?
Update
Few more commands
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'hostname';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> SHOW GRANTS FOR 'repl'@'hostname';
+----------------------------------------------------------+
+--+ | Grants for repl@hostname |
+--+ | GRANT REPLICATION SLAVE ON *.* TO `repl`@`hostname` |
+--+ 1 row in set (0.00 sec)
+----------------------------------------------------------+
Command
CHANGE REPLICATION SOURCE TO
SOURCE_HOST='$sourceip',
SOURCE_USER='repl',
SOURCE_PASSWORD='$replicapass',
SOURCE_LOG_FILE='Source-bin.000001',
SOURCE_LOG_POS=481;
log_bin=/some/path/binlog
? TrySHOW MASTER STATUS;
on master host to verify if replication enabled.SHOW GRANTS
work for current user that isroot@localhost
You have to useSHOW GRANTS FOR 'repl'@'hostname'
insteadCHANGE REPLICATION SOURCE TO
command. I'm not sure why you need this? In my case Replica's IP is changed.