Make MySQL dump from parts of each table

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

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

How do you mysqldump specific table(s)?

Updated June 19, 2015 23:02 PM

Backup and restore "mysql" database

Updated September 14, 2017 22:06 PM