Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •