Some MySQL Questions Please help

Discussion in 'MySQL' started by volldepp54, Jul 21, 2008.

  1. #1
    Hi!

    Can i run two identic databases on one server? I mean, the databases have different names, just the tablenames of the databases would be identic.

    I have a database in txt format that i want to import to my existing databases but the prefixes of the tablenames are different. Is there a tool that let's me change the prefixes of the database all at once?

    Thanks in advance for any help.

    Regards,

    Jan
     
    volldepp54, Jul 21, 2008 IP
  2. 4Offsets

    4Offsets Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes you can have two dbs, dbPrimary and dbBackup each containing the same database structures and even identical/different data sets.

    not sure if you have many table to move from old DB to new one, but just query the table in the order of the new table:

    Select oldColumnC, oldColumnA, oldColumnB from myTable, order by oldColumC

    you should be able to export it, then import it into new DB and ingnore the table names.

    i use myphpadmin to work with mysql db, the import and export tools are pretty good.
     
    4Offsets, Jul 21, 2008 IP
  3. volldepp54

    volldepp54 Banned

    Messages:
    224
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3

    i am not sure if i understood that right.

    How do i change the prefix names of the tables?

    I mean change phpfox2_user to phpfox_user for all tables all at once.
     
    volldepp54, Jul 21, 2008 IP
  4. 4Offsets

    4Offsets Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    export into SQL the database structure (you could try structure and data if the total output will fit in your editor), put in text editor and substitute phpfox2_user fox phpfox_user then import that into mysql as sql.
     
    4Offsets, Jul 21, 2008 IP
  5. spyrit

    spyrit Well-Known Member

    Messages:
    1,788
    Likes Received:
    94
    Best Answers:
    0
    Trophy Points:
    150
    #5
    to change the prefix just open it with a text editor and click search and replace, enter what you want to replace and with what and hit go and they will all be replaced.

    remember to make a backup before ;)
     
    spyrit, Jul 22, 2008 IP