Question

I have several tables in MySQL database and those tables are already filled;

Is there any way to get DML, which fills tables with same name, with exact same data?

for ex. if I have table (names) like this:

name_id : 1
name_val : john
name_id : 2
name_val : jack

I want to get this kind of DML :

Insert into table names(name_id,name_val) values(1,'john');
Insert into table names(name_id,name_val) values(2,'jackn');
Was it helpful?

Solution

You can utilize mysqldump

To get only data use --no-create-info parameter

mysqldump -u user -p[password] --no-create-info --compact db_name table_name > dump.sql
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top