2

I have MySQL MASTER/SLAVE replication working on two test boxes (Centos 6.4 / MySQL 5.5.32) over LAN.

Securing the connection over ssh causes connection problems from the SLAVE machine:

(Sample of show slave status \G Output)

Last_IO_Errno: 2003 Last_IO_Error: error connecting to master '[email protected]:3305' - retry-time: 60

I have granted the replication user the relevant privileges on the master server with both 127.0.0.1 and the network IP.

I have forwarded the port from slave to master over SSH

ssh -f 192.168.0.128 -L 3305:192.168.0.128:3306 -N

I can connect to master MySQL from slave with

mysql -urep -ppassword -h127.0.0.1 -P3305

The master server setup would seem fine, as it works without a tunnel, and the tunnel seems fine, as I can connect to MySQL between the two.

Change Master Statement:

CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3305, MASTER_USER='rep', MASTER_PASSWORD='password';

Note: I know there are reasons to use SSL, instead of SSH, but I have reasons why SSH is a better choice for my setup.

12
  • What parameters did you enter exactly in the CHANGE MASTER TO: statement?
    – NickW
    Aug 7, 2013 at 10:07
  • CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3305, MASTER_USER='rep', MASTER_PASSWORD='password';
    – Dom
    Aug 7, 2013 at 10:15
  • anything in your master mysql log file?
    – NickW
    Aug 7, 2013 at 10:20
  • You have added the binlog and log file position as well right?
    – NickW
    Aug 7, 2013 at 10:23
  • 1
    I can't submit my own answer, yet, but to save other people's time, it turns out the issue was SELinux not allowing MySQL on a non-standard port.
    – Dom
    Aug 7, 2013 at 16:12

2 Answers 2

4

Thanks for your help, guys, but it turns out the issue was SELinux not allowing MySQL on a non-standard port.

3
  • Silly SELinux.. Aug 8, 2013 at 9:04
  • +1 for finding you own answer. Aug 8, 2013 at 14:41
  • Aaaa damn you SELinux! @Dom if I could I would give you any bounty there was! Thanks a lot! After 4 days of searching high and low, this was it! :) Dec 3, 2016 at 21:44
1

You can use semanage to allow additional none standard port for mysqld

sudo /usr/sbin/semanage port -a -t mysqld_port_t -p tcp 3305

then you may verify using

sudo /usr/sbin/semanage port -l | grep mysql

you'll see the new port displayed along with the standard port 3306

mysqld_port_t tcp 3305, 3306, 63132-63164

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .