MYSQL Master/Slave Replication Error

Posted April 17, 2018 4.3k views
MySQLUbuntu 16.04

Struggling with MYSQL Master/Slave replication.

I followed the the DigitalOcean document for setting up the MYSQL Master/Slave replication.

Both servers only allow SSH login and the SCP command to move copy the database dump required me to use my “admin” account and required me to enter my SSH passphrase.

the SQL.CNF has the requiresecuretransport = on

The connection error I get from SHOW SLAVE STATUS\G is below

LastIOErrno: 3159
LastIOError: error connecting to master ’<replication_account_name>@<priv_ip_address>:3306’ - retry-time: 60 retries: 23

Do I need to create a SSH key for the <replication_account_name> account on both servers or is the fix something else? If so what?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Your current configuration is not using SSH for it’s connections as that is not covered by the guide you followed. This guide covers the changes needed to tunnel your master/slave connections over SSH.

Right now it appears that your configuration is attempting to connect directly to MySQL on port 3306 but MySQL does not listen on the public IP by default for security reasons so it is unable to reach the other server.

by Jesin A
This tutorial describes how to secure MySQL Replication using SSH on a VPS.

Awesome thanks. I suspected as much, but was struggling to find the right article to guide me.

  • will go through this article.

Nice article about tunnelling, thanks.
However, I wonder if it wouldn’t be more efficient to use Mysql ssl encryption to secure the replication ?
See doc here :

I’m very curious to know which solution is faster, what are your thoughts about it ?