MariaDB replication. Create an account.
Last updated: Jul 13, 2022
Colleagues hello to all.
In today's article we will talk about how to create a replication account and why you need it at all. The replication process itself in MariaDB is when data is copied from one database server to another database server. Connections between servers are implemented just through the account.
A replication user is the same user as all other users in the database. The account name can be anything, but there is a non-public rule to name such a user, for example, slave_user or replicator. We will create a user named replication.
mariadb> CREATE USER 'replication'@'%' IDENTIFIED BY 'Qwerty123';
After we have created the replication user, now we need to assign the necessary rights to it. In order for the user to be able to replicate data from the source to the replica, he needs the right called REPLICATION.
mariadb> GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
After all that we have done it is desirable to execute the command:
mariadb> FLUSH PRIVILEGES;
With this command, we tell MariaDB to flush the cache tables mysql.user and mysql.priv and re-read these tables.
Thank you all, I hope that my article helped you in some way.