How to upload database contents from another domain/site to new empty db

Discussion in 'Databases' started by ddzc, Mar 20, 2012.

  1. #1
    Hi everyone,

    I acquired a site (wordpress based) and the database file has the content of the old users mysql database credentials (database name, database user id, passwod). I'm changing domains and need the files and db onto my new domain. I'm using phpmyadmin.

    I created a new mysql database with my own unique db name, uid and password. I want to import the contents and tables of the old database into the my empty database. I remember doing this in the past and it would not work because the contents of the .sql file has the old user information. Should I do a find/replace on the database name, uid and password in the sql file before attempting to upload/import? I know there's other steps involved with getting this to successfully work...I believe a critical line in the file has to be commented out but I can't remember which one it is.

    Any help would be appreciated.

    Thanks
     
    Last edited: Mar 20, 2012
    ddzc, Mar 20, 2012 IP
  2. yauza

    yauza Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You will have to edit the database name, user and password from the wp-config.php file
     
    yauza, Mar 20, 2012 IP
  3. sitegiant

    sitegiant Active Member

    Messages:
    970
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    it should work if you open the old database and and cahnge the URL. You could alos export and them import the XML.
     
    sitegiant, Mar 21, 2012 IP
  4. emrom

    emrom Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you need help, or someone to do this for you PM me your email address.
     
    emrom, Mar 27, 2012 IP
  5. javamazon

    javamazon Active Member

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #5
    I have recently created this , as i have took backup of my DB before reinstalling wordpress site.

    When you take a backup of DB , you create a .sql file which start from CREATE DB ... , so if you have already created a Database name in your backend and if you try to import the this file it will fail as you have already created one in the backend and the exported file as a statement CREATE DB in its first line.

    So my suggestions are remove the very first line CREATE DB.. and keep the other stuffs like CREATE TABLE..(POSTS TABLE,USER TABLES,COMMENTS TABLE) and try to import .

    Just give a try

    I have tried to explain in short ,Thanks
     
    javamazon, Apr 20, 2012 IP
  6. abdurrahman

    abdurrahman Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    u can use import and export command to load the contents into yr new database. or
    u can also use the sql loader.
     
    abdurrahman, Jun 3, 2012 IP
  7. alimumtaz123

    alimumtaz123 Greenhorn

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #7
    First you have to make a back on the first site and than download all data, and then upload the same on another site
     
    alimumtaz123, Jun 12, 2012 IP