Question

I want help to replicate only couple tables between two nodes.

Posted November 15, 2018 804 views
MySQLArch Linux

I am a beginner, I did not take any steps as of now.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

If you would like to export only two tables and import them to your second node you could use the mysqldump command, it would look something like this:

mysqldump -u root -p your_db_name_here  table1 table2 > your_db_name_tables1_2.sql

Then you could copy the .sql file over to your seconde node and import it:

To copy the file use:

scp your_db_name_tables1_2.sql root@your.second.node.ip:/root/

To import the file to your database on your second node, first ssh to the second node and run:

mysql -u root -p your_db_name < your_db_name_tables1_2.sql

If you are actually after MySQL replication setup, you can follow the steps here on how to set that all up:

https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

Hope that this helps!
Regards,
Bobby