HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Changing master for channel gives syntax error

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
errorsyntaxgivesmasterforchangingchannel

Problem

I'm trying to set up a multi-source replication

When trying to set a master for a specific channel using this query

CHANGE MASTER TO MASTER_HOST='192.168.0.203', MASTER_USER='rep', MASTER_PORT=3306, MASTER_PASSWORD='pass', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=107 FOR CHANNEL 'master-203';


I get the following error


Error Code: 1064. You have an error in your SQL syntax; check the
manual that corresponds to your MariaDB server version for the right
syntax to use near 'FOR CHANNEL 'master-203'' at line 1

I can't figure out what's the problem. The query is pretty much a copy-paste from the official documentation

My server is running MariaDB 10.1.21

What could be wrong?

Solution

You're looking at the documentation for MySQL 5.7, but you're running MariaDB 10.1, and replication channels happen to be a feature that is implemented differently in MariaDB.

From the MariaDB documentation on multi-source replication:


You specify which master connection you want to work with by either specifying the connection name in the command or setting default_master_connection to the connection you want to work with.

So in your case you could try:

CHANGE MASTER 'master-203' TO MASTER_HOST='192.168.0.203', 
MASTER_USER='rep', 
MASTER_PORT=3306, 
MASTER_PASSWORD='pass', 
MASTER_LOG_FILE='mysql-bin.000003', 
MASTER_LOG_POS=107;


(Disclaimer: I've not tried this in practice.)

Code Snippets

CHANGE MASTER 'master-203' TO MASTER_HOST='192.168.0.203', 
MASTER_USER='rep', 
MASTER_PORT=3306, 
MASTER_PASSWORD='pass', 
MASTER_LOG_FILE='mysql-bin.000003', 
MASTER_LOG_POS=107;

Context

StackExchange Database Administrators Q#198302, answer score: 2

Revisions (0)

No revisions yet.