Quickly Set Up MySQL Master‑Slave Replication with mysqlreplicate
This guide introduces MySQL Utilities, demonstrates how to configure master‑slave replication in seconds using the mysqlreplicate command, explains required user creation, showcases additional tools like mysqldiskusage and mysqlindexcheck, and provides installation and download instructions.
MySQL Utilities is a toolbox of handy MySQL tools. One of the most useful commands is mysqlreplicate, which can configure a master‑slave replication environment with a single command.
Usage
mysqlreplicate \
--master=root:[email protected]:3306 \
--slave=root:[email protected]:3306 \
--rpl-user=replutil:111111--master specifies the master server connection, --slave specifies the slave server, and --rpl-user provides the replication user that must already exist on the master.
First, create the replication user on the master, for example:
grant ALL PRIVILEGES on *.* to replutil@"192.168.31.101" identified by "111111";Note: the slave IP must be explicit; do not use ‘%’.
Only two steps are needed: (1) create the replication user on the master, and (2) run the mysqlreplicate command. The setup completes in a few seconds.
MySQL Utilities includes many other tools, such as mysqldiskusage to view database space usage:
mysqldiskusage --server=root:111111@localhostAnother useful command is mysqlindexcheck to detect redundant indexes:
mysqlindexcheck --server=root@localhost employeesInstallation
Download and extract MySQL Utilities, then run:
python ./setup.py build
python ./setup.py installAfter installation, the utility commands are ready to use.
Download and Documentation
Download: http://dev.mysql.com/downloads/utilities/1.5.html
Documentation: http://dev.mysql.com/doc/mysql-utilities/1.6/en/utils-overview.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
