Solved

export part of table from production to local DB (MySQL)

Posted on 2009-06-29
3
439 Views
Last Modified: 2012-05-07
Hi: There!

I have an urgent question related to MySQL, I have a table in Production database. It has millions recodes since it is history table. But at this moment, I only need part of the table. I make a SQL query. How to export/dump this query result so that I could put recodes/rows into local development environment for debug?
0
Comment
Question by:JianJunShen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 24742849
You will want the SELECT..INTO OUTFILE syntax:

http://dev.mysql.com/doc/refman/5.0/en/select.html#id4313597
0
 

Author Comment

by:JianJunShen
ID: 24742946
Thanks a lot. How to import this generated file into local MySQL database.
0
 
LVL 50

Assisted Solution

by:Steve Bink
Steve Bink earned 500 total points
ID: 24743178
They have one for that, too:

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Be aware that there is a configuration directive (--local-infile) that affects this statement in certain contexts.

http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_local-infile
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Creating and Managing Databases with phpMyAdmin in cPanel.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question