Make MySQL dump from parts of each table

by Oleksandr Hubachov   Last Updated September 11, 2019 16:06 PM

I need to export some data from different tables. I tried this query

select * into outfile 'C:\Users\\User\\Desktop\\ololo.sql' from db.users where id % 2 = 1;

After this query, the SQL file was created. When I use id i in the the same query to export data from other table. Thus, an error happens. I need additional data from the other table. So, the result must be not dump of all database but part of it. Thanks for your answers.

Answers 1

You need to use mysqldump option --where like this:

mysqldump -uroot -p --where="id % 2 = 1" db users > C:\Users\User\Desktop\ololo.sql

Give it a Try !!!

March 26, 2014 14:58 PM

Related Questions

Updated July 07, 2015 16:02 PM

Updated January 11, 2017 08:02 AM

Updated June 19, 2015 23:02 PM

Updated September 14, 2017 22:06 PM