1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Creating mySQL database offline then uploading to website

Discussion in 'MySQL' started by patwa, Mar 12, 2007.

  1. #1
    Hello.

    I was wondering if there is a simple way to create a ySQL database offline and then upload it to my website?

    I have both mySQL and PHPMyAdmin on my website, but also have it set up on my own laptop (was using it for coursework), and as I'll be spending more than 14 hours on a train in the next two days I want to get some database work done so that I can just have it ready to load onto the website when i get back.

    I would rather not have to write an entire text file or SQL code to set up tables, etc, even though I could.

    Thanks.

    H.
     
    patwa, Mar 12, 2007 IP
  2. Notorious

    Notorious Well-Known Member

    Messages:
    903
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Notorious, Mar 12, 2007 IP
  3. spachev

    spachev Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just configure the laptop the same way your main server is configured. Then work on the laptop as you would on your regular server. Then to transfer the data mysqldump -A | mysql -h server_name
     
    spachev, Mar 12, 2007 IP
  4. patwa

    patwa Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks. I'll try both of those suggestions, installing WAMP now and then will work on the databases on the train. As long as I can get them up onto the website (which is hosted on a paid webhost) I'll be happy - it'll save a lot of time and stop me getting bored.

    H.
     
    patwa, Mar 12, 2007 IP
  5. patwa

    patwa Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hello.

    I was trying to use the dump command, but am unsure of the syntax for my local machine.

    I'm using ssh under cygwin (basically as good as Unix) so would it just be:

    mysqldump orders | ssh /cygdrive/c/www/ mysql orders

    To transfer the database to my laptop. I would put:


    mysqldump orders | ssh mysql orders

    To get back to my website, but how do I reference the folder where the database is stored on my laptop, e.g the /cygdrive/c/www/ ?

    The /cygdrive part is the path to the folder on my laptop where I've got my website's files.

    Could I then import this into PHPMyAdmin?

    Sorry but still a little confused.



    H.
     
    patwa, Mar 12, 2007 IP
  6. hdpinn

    hdpinn Peon

    Messages:
    48
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If it's a large database, upload it in gz format, 7zip is a great program for windows.

    Login to SSH.

    CD to the folder you uploaded to

    Run gunzip filename.gz

    Now run mysql command to import it.

    mysql -u username -p -q database < filename

    Works like a charm!
     
    hdpinn, Mar 12, 2007 IP