If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Inserting Data From One Database to Another

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-21-11, 15:54
Hioncc Hioncc is offline
Registered User
 
Join Date: Feb 2011
Posts: 1
Inserting Data From One Database to Another

Hello,

Thank you kindly for taking the time to read this.

I have two databases:
-Database A (This has all my customer data, order data, etc). With 250 odd tables.
-Database B (This has all the tables, but is blank with no data).

The databases are almost exact, a few new tables in Database B. They are both on localhost.

Now, how is the best way to move all the data from Database A, into the exact same tables that are blank on Database B?

I mainly script HTML/PHP, and as such have little knowledge of MySql.
I am hoping someone can assist as it would be greatly appreciated.

Kindest Regards
Reply With Quote
  #2 (permalink)  
Old 02-21-11, 16:42
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
Quote:
Originally Posted by Hioncc View Post
Now, how is the best way to move all the data from Database A, into the exact same tables that are blank on Database B?
run mysqldump, then feed the .sql file into the target database through either the command line or some front end app like heidisql or the mysql browser

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 02-21-11, 18:02
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
As Rudy says use mysqldump to generate the SQL statements needed to backup your primary database. You should make sure that your destination database is newly created with no tables. If you have tables created with triggers enabled you may end up with data inconsistencies i.e. duplicate records.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On