Trying to create an database replication server. I setup my slave server with this SQL:
CHANGE MASTER TO MASTER_HOST='[IP OF MASTER SERVER]', MASTER_USER='replication_user',
MASTER_PASSWORD='[PASSWORD]', MASTER_PORT=[PORT], MASTER_LOG_FILE='master1-
bin.000001', MASTER_LOG_POS=42266, MASTER_CONNECT_RETRY=10;
I get this error, when I run SHOW SLAVE STATUS \\G:
Last_IO_Error: error connecting to master 'replication_user@[IP]:[PORT]' - retry-time: 10 maximum-retries: 86400 message: Can't connect to MySQL server on '[IP]' (13 "Permission denied")
I am able to access my master mysql server from my slave server if I run this command:
mysql -ureplication_user -p[PASSWORD] -h [IP] -P [PORT]
bind-address and skip-networking is commented out in the master server cnf file. I have also executed these SQL in Master when I created the replication user:
CREATE USER ‘replication_user’@’%’ INDETIFIED BY ‘[PASSWORD]’;
GRANT REPLICATION SLAVE ON *.* TO ‘replication_user’@’%’;
I am using a custom port for my mysql server on the master, which I also have opened up for in the firewall of the master server.
Found out that SElinux doesn't allow non-standard ports for mysql.
Fixed the problem by running following command in the slave server:
sudo /usr/sbin/semanage port -a -t mysqld_port_t -p tcp [PORT]
Where [PORT] needs to be the port that you use for your master mysql server. This will tell SElinux to allow non-standard ports.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.