MySQL Forums
Forum List  »  Replication

Error connecting to master (for mysql db replication), code 1045
Posted by: Dustin Soodak
Date: April 04, 2017 02:33PM

I've found several other posts with similar symptoms such as
https://forums.mysql.com/read.php?26,653711,653711#REPLY
but they all seemed to be resolved by making password shorter or removing '#' from password if put in a configuration file.

Neither of these fixes apply to me so I'm a bit stuck.



Here's the details:

edits to master my.cnf file:
/etc/my.cnf
server-id=1
binlog_do_db = radius
bind-address=master_ip_address #was 127.0.0.1

mysql -V
Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64)

CREATE USER 'repl'@'%' identified by 'password';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
SHOW MASTER STATUS;
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
| master-bin.000012 | 4692 | radius | |


edits to slave mysqld.cnf (included by /etc/mysql/my.cnf):
server-id = 3
relay_log_recovery=1 #added because "relay file failed to initialize" error
relay-log = /var/log/mysql/mysql-relay-bin.log
log_bin = /var/log/mysql/mysql-bin.log

mysql -V
mysql Ver 14.14 Distrib 5.7.17, for Linux (i686)

STOP SLAVE
CHANGE MASTER TO MASTER_HOST=”master_ip_address“, MASTER_USER=”repl”, MASTER_PASSWORD=”my_pass”, MASTER_LOG_FILE=”master-bin.000012″, MASTER_LOG_POS=4692;
START SLAVE

Can log using
mysql -u repl -p -h master_ip_address

with no problem but slave server won't connect for replication:

tail /var/log/mysql/error.log
2017-04-04T18:46:42.734929Z 12 [ERROR] Slave I/O for channel '': error connecting to master 'repl@master_ip_address:3306' - retry-time: 60 retries: 21, Error_code: 1045

SHOW SLAVE STATUS \G
Slave_IO_State: Connecting to master
Master_Host: master_ip_address
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000012
Read_Master_Log_Pos: 4692
Relay_Log_File: mysql-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: master-bin.000012
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 4692
Relay_Log_Space: 154
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1045
Last_IO_Error: error connecting to master 'repl@master_ip_address:3306' - retry-time: 60 retries: 1
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 170404 11:26:42
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:

Options: ReplyQuote


Subject
Views
Written By
Posted
Error connecting to master (for mysql db replication), code 1045
23295
April 04, 2017 02:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.