1

Although I can connect from slave to master via a command-line mysql client, my slave can't connect to the master as part of its replication task. SHOW SLAVE STATUS cites a "Permission denied" error:

Last_IO_Error: error connecting to master 'replicant@dbmaster:5000' - retry-time: 60 maximum-retries: 86400 message: Can't connect to MySQL server on 'dbmaster' (13 "Permission denied")

I've checked the user permissions as well as a command-line client connection. What else can I check?

The user has SELECT and REPLICATION SLAVE permissions on the master:

mysql -h dbmaster -P 5000 -u replicant "-p$PASS" --ssl -e 'SHOW GRANTS'
# +--------------------------------------------------------------------------------------------------------------------------------------------------------+
# | Grants for [email protected]                                                                                                                   |
# +--------------------------------------------------------------------------------------------------------------------------------------------------------+
# | GRANT SELECT, REPLICATION SLAVE ON *.* TO `replicant`@`192.168.187.101` IDENTIFIED BY PASSWORD '[HASH-REDACTED]' REQUIRE SSL |
# +--------------------------------------------------------------------------------------------------------------------------------------------------------+

And I've set up the slave to use the same username, password, host, port, ssl:

cat <<-EOF | mysql
STOP SLAVE;
CHANGE MASTER TO MASTER_SSL=1, MASTER_DELAY=259200,
MASTER_HOST='dbmaster', MASTER_PORT=5000,
MASTER_USER='replicant', MASTER_PASSWORD='$PASS',
MASTER_LOG_FILE='mysql-bin.041117', MASTER_LOG_POS=733093730;
START SLAVE;
EOF

The server is running Mariadb 10.3.

1
  • I've also tried just changing the password multiple times: STOP SLAVE; CHANGE MASTER TO MASTER_PASSWORD = '...'; START SLAVE;, but the error is the same, and the slave status shows Slave_IO_Running: Connecting Jan 25, 2021 at 20:43

1 Answer 1

-1

cat <<-EOF | mysql Line OK STOP SLAVE; Line OK

CHANGE MASTER 'AnyName4Slave' TO MASTER_HOST = '',MASTER_PORT=3306, MASTER_USER = 'user', MASTER_PASSWORD = 'password' ,MASTER_LOG_FILE='mysql-bin.041117', MASTER_LOG_POS=733093730;

START SLAVE 'AnyName4Slave'; EOF

3
  • Can you explain your answer? I'm not sure how closely this is meant to apply to my environment. For example, my server is using the nonstandard port 5000, as evidenced by my the connection established for my successful SHOW GRANTS command. Jan 26, 2021 at 17:58
  • use your own port , rest of slave connection is same Jan 28, 2021 at 6:53
  • can you help explain the important differences between your command and the command that I shared in my post? (I don't see any material differences except (1) the fact that you use a name for the slave and (2) the fact that you are using different values than I used for port, host, user, and password.) Feb 1, 2021 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.