From: Johan De Meersman Date: January 24 2012 10:13am Subject: Re: Copying data from one to another MySQL sesrver List-Archive: http://lists.mysql.com/mysql/226655 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "bars0.bars0.bars0" > > Hi all! > > I need to copy data (result set from query) from one server to > another. > This will be done once a month (so cron will be involved:), for data > from previous month. > Any ideas how can I achieve this? > > Should I export query as INSERT SQL statement first and next read > that exported file, or there is some other solutions? That's generally the most convenient way, but you need to be able to transform the query output to SQL statements reliably :-) If you're only selecting from a single table, mysqldump has the option to take a where statement. If you need to select from multiple tables I suspect you'll either have to go through "select into outfile" and "load data infile" or write a custom script to achieve similar functionality. -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel