Results 1 to 3 of 3

Thread: [RESOLVED] Transfer MySQL db to another MySQL DB

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Resolved [RESOLVED] Transfer MySQL db to another MySQL DB

    I have to migrate data from one MySQL database table to another MySql database table in a different MySql database. Most of the fields do not match data types and are not even in the same order. Even in those fields that do match, on occasion, the datatypes are completely different (varchar vs int, varchar vs char, int vs datetime, etc.).

    I'm using MySQL version 4.1.12.

    Does anyone have any suggestions as to the easiest way to do this.

    Thanks in advance for any help you can give.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Transfer MySQL db to another MySQL DB

    You can use an INSERT query:
    Code:
    INSERT INTO db1.table SELECT field1,field2 FROM db2.table
    How do the data types differe and what meks them likyly to change? Once set the data type of a column is set.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: Transfer MySQL db to another MySQL DB

    visualAd:

    Thanks for your suggestion, but I already tried something like that and it won't work due to the difference in the way the two databases were set up.

    The old database wasn't designed very well. Some fields that should be char or varchar were set as int and the order of the fields is all messed up. Field 1 in the old database is field 4 in the new database.

    I have been transfering the data one field at a time using an insert and loop and it is working ok. I just thought I might discover an easier way.

    There are about 10,000 records with 12 fields in each record.

    I am about a third of the way through it, so guess I will make it ok. I am just glad that there wasn't 100,000 records or more.

    Thanks Again.

Posting Permissions

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



Click Here to Expand Forum to Full Width