MySQL replication - Error connecting to master

2019-07-04 02:13发布

I'm trying to set up replication in MySQL but I am being given an error that I do not know how to fix -

ERROR 1218 (08S01): Error connecting to master: Host 'sh047.mydomain.com' is not allowed to connect to this MySQL server

I've added the following code to the master my.ini -

server-id=238429
log-bin=mysql-bin
log-error=mysql-bin.err
binlog_do_db=my_databases_to_replicate {not literal, have listed the correct databases}

And I've added this to the slave my.ini -

server-id=2
master-host=192.168.1.15
master-user=replication
master-password=my_password
master-connect-retry=60
replicate-do-db=my_databases_to_replicate

The user 'replication' exists and the password that I use in the slave my.ini is correct. Any suggestions as to how to fix this would be welcome.

Thanks.

1条回答
做个烂人
2楼-- · 2019-07-04 02:42

The error message says it all:

Host 'sh047.mydomain.com' is not allowed to connect to this MySQL server

Make sure the user replication is configurated as replication@sh047.mydomain.com (or, but only for testing purposes: replication@%) on your master database.

If this doesn't work out, check the MySQL Documentation for this, there might be one or two special cases (Linux compilation etc.), where that error might occur, too.

查看更多
登录 后发表回答