Sep 6, 2021

Export one table from one MySQL instance to other MySQL instance

Syntax 

Export one table:

$ mysqldump -u root -p database_name table_name > dump.txt

password *****

Import one table:

$ mysqldump -u root -p database_name table_name < dump.txt

password *****


Below was the actual request...

Please copy MySQL table charge_master from clt-mysqlP_11.b_Rore to clt-mysqlD_61.SMS


Step by step implementation... 

--Connect MySQL on clt-mysqlP_11

Step 1. Take the row count.

mysql> select count(*) from b_Rore.charge_master;

+----------+

| count(*) |

+----------+

| 15076362 |

+----------+

1 row in set (40.58 sec)


Step 2: Export dump...

mysqldump -u user_name -p b_Rore charge_master > D:\Backup\charge_master.txt


Step 3: copy dump file:

copy the dump file D:\Backup\charge_master.txt from source to distination server.

In my care, it is from clt-mysqlP_11@D:\Backup\charge_master.txt to clt-mysqlD_61@D:\Backup\1\qtrly_pa_charge_master_pa_charge_master.txt


Step 4: Import dump...

connect clt-mysqlD_61

mysql -u user_name -p SMS < D:\Backup\1\charge_master.txt


Step 5. Take the row count.

mysql> select count(*) from b_Rore.charge_master;

+----------+

| count(*) |

+----------+

| 15076362 |

+----------+

No comments:

Post a Comment

If you have any doubt or question, please contact us.