How to Create a Replication user on Master Node

April 4, 2024 / How-to Guide

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:

  1. To start, use this command to connect to the MySQL shell-
    mysql -u root –p
  2. Create a replication user using the below command-
    mysql> CREATE USER 'replication_user'@'your-slave-ip' IDENTIFIED BY 'password';
  3. Then, grant all privileges to the replication slave. Run the below command-
    mysql> GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'your-slave-ip';
  4. After that, flush the privileges-
    mysql> FLUSH PRIVILEGES;
  5. Finally, verify the Master status with this command-
    mysql> SHOW MASTER STATUS\G
  6. 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.

Spread the love