Friday, 26 October 2018

Get dump of MySQL table data

MySQL dump of only single table record  data 


mysqldump -u root -PPORT_NUMBER -ppassword  --complete-insert database_name table_name > file_name.sql

MySQL dump of only multiple table record  data 


mysqldump -u root -PPORT_NUMBER -ppassword  --complete-insert database_name table_name1 table_name2 table_name3...  > file_name.sql

MySQL dump of only selected record 

mysqldump -u root -PPORT_NUMBER -ppassword database_name table_name --where="condition"

Example.

1)  mysqldump -t -u root -P3306 -ppassword school student --where="studentId=123"

                                                                   OR

   mysqldump -t -u root -ppassword school student --where="studentId=123" (without port)

2)  mysqldump -t -u root -ppassword school student --where="studentId=123 AND Name Like %sant%"

No comments:

Post a Comment