In this article, we will explain how to create a replication user on master node. For this, you will have to build a new user for replication and grant privileges to the replication slave.
Follow the steps:
- To start, use this command to connect to the MySQL shell-
mysql -u root –p
- Create a replication user using the below command-
mysql> CREATE USER 'replication_user'@'your-slave-ip' IDENTIFIED BY 'password';
- Then, grant all privileges to the replication slave. Run the below command-
mysql> GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'your-slave-ip';
- After that, flush the privileges-
mysql> FLUSH PRIVILEGES;
- Finally, verify the Master status with this command-
mysql> SHOW MASTER STATUS\G
- You should receive the specified output-
******************* 1. row ********************
File: mysql-bin.000001 Position: 900 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: 1 row in set (0.00 sec)In the output above, remember to write down the values for “mysql-bin.000001” and “Position ID 900”. You will need both when setting up a slave server.
This way you can create a replication user on Master Node. Hope you liked our article. For further assistance, contact our support team at any difficult moment.