How To Restore Your Database; Help For The Amateur Like Me.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phenomenon
    Member
    • Sep 2003
    • 61
    • 2.3.2

    How To Restore Your Database; Help For The Amateur Like Me.

    Greetings,

    Not all of us are savvy web-monkeys. I myself am just a monkey. I drool, I screech, I throw things, and it took me an entire day and half the night to figure out how to restore a database backup that the vbulletin staff was kind enough to create for me (Thanks again Jerry!!!)

    So you've got a several MB backupName.sql file. Mine was called vbulletin.sql. I'm going to call yours 'backupName.sql'. Creative eh!?

    My host has me on a linux VDS -- virtual server of some kind. I believe a lot of hosts probably have that set up, as it's cost effective. We like cost-effective.

    I logged into my site using an ftp client called Transmit for OS X. As most of the world is still using Windows, you'll probably be using smartFTP or cuteFTP or just the internet explorer ftp.

    I copied my backupName.sql file to my root directory. Not my htdocs, or www directory (or the directory that has my home page and my /forums directory in it), but the (/) root directory. Not everyone has access to that, I understand that. If you don't, copy it up to your directory that has your forums directory, and you should be ok, but you just need to know what the full path from the root to that directory is. (in my case that would be /usr/local/apache/htdocs).

    Next, you need an empty database to restore your forum to, that your new forum will refer to. Let me repeat this:

    YOU NEED AN EMPTY DATABASE.

    Unless you like pulling out hair, drooling, or screeching at passers-by from high places, save yourself some energy and make yourself an empty database. I did this in a typically newb manner by logging into my PhpMyAdmin, clicking on the 'homel link in the upper left corner of the left frame (because of my limited experience, I'm not sure if this always says home or what. I'm assuming it does, but if you don't see 'home' then click on whatever the very top link is in the left frame), then entering databaseName into the 'create new database field?' input field in the main area of the right frame, and then hitting create. (Enter whatever name you plan on calling your database where I've written databaseName). The page should refresh, and then under the little 'home' link, there should be a new link with databaseName.

    (If you're not sure how to get to PhpMyAdmin, you'll have to check out your host's support pages. I'm hoping you know how to do that already. If you don't, go ahead and post and I or someone else will try to help you)

    Next, you get to play with ssh! I was terrified of having to do this, and it's not so bad, trust me. I know I'm a monkey, but you can still trust me. I even shave sometimes. I searched all over this forum, all over the internet, for alternative, easier ways of doing this. The only alternative you have is uploading your backupName.sql file into PhpMyAdmin. This generally doesn't work as the server will time out with a file greater than 1mb and will frustrate the pants off you. And unless you like your rear to be hanging in the breeze, you might as well give it up and resign yourself to using ssh.

    Don't worry, it's not that bad. If I can do it, -- and I'm a card carrying idiot -- you can do it!

    If you're on a Mac, you're in luck, as you have the Terminal app in your Applications/Utilities folder. If you're not on a Mac (or linux/unix machine), well in the words of Mr. T, "I pity the fool!" Download PuTTY http://www.chiark.greenend.org.uk/~sgtatham/putty/. It's free, and free rhymes with cost effective..ee. Or something. What is this folk music? Anyway...

    On Mac terminal: type in
    Code:
    ssh -l [b]username[/b] [b]domainName.com[/b]
    It will ask you for your password. Enter that (it won't show you what you're writing, and the backspace key works in funny ways there), and you'll be greated with a prompt that says, 'bash$'. I think that may be a political statement...

    On PuTTY:
    When you first open PuTTY you'll get a PuTTY Configuration window. It will have a lot of options. For us monkeys, we don't know nor really care what all the options are for. On the left of the Configuration window you have a 'Category' Column. On the right you have a bunch of options. Enter yourdomain.com into the "Host Name {or IP address)" text input box. SSH should be selected by default underneath in the "Protocol" row.

    This will open a window that looks like an old DOS prompt, or the cmd prompt in XP (which always makes me wonder what Windows is really operating on?)

    You will see text: "login as:" enter your username and hit enter.
    Next it will prompt you for a password. Enter that, hit enter.

    Then you, too, will be greeted by that bash$ prompt. Put down your hammer and leave your quarters alone. It's not a subliminal message.

    Typically, this will log you into the root level of your host server. Different hosts log you into different places. The commands you're going to find useful right now are the Change Directory command, or 'cd', the List command, or 'ls'. Briefly, to see what the contents of the directory you're in right now, type "ls". To enter into a new directory, type, "cd directoryName". To back out and go up one level, type, "cd ..".

    Next, you're going to want to log into the directory on your server that mysql runs out of. I had to do this because otherwise I didn't have user permissions for MySQL to run. Your server may be configured differently, but if you're reading this because you got ./mysql permission denied, then you'll want to navigate to the folder with mysql in it. For me, mysql was located in /usr/local/mysql/bin. Your mysql may be elsewhere. You may have to contact your host, or read their support pages, to find it. Or you can log in with an ftp client like I did and just poke around until you find a mysql folder.

    For me, I had to type in:
    Code:
    cd usr/local/mysql/bin
    This put me in the folder that had the mysql application in it. To make sure I typed "ls" -- that lists the contents of that directory. I saw mysql lurking there. At this point you may screech and throw fruit at passers-by in celebration.

    Next, you actually restore the database. Type the following:

    Code:
    mysql -u [b]username[/b] -p [b]databaseName[/b] < /path/to/your/[b]backupName.sql[/b]
    and hit enter. It asked me for my password next, which I managed to type wrong and it errored out. The second time I typed it right and after a brief pause, I was presented with the bash$ prompt again.

    It may take some time, especially if your database is huge. Mine was 3MB, and it only took a few seconds.

    At this point your database should be restored. I logged back into MyPhpAdmin and checked my previously empty databaseName. Sure enough, it was chock full of MySQL goodness. I praised my various holy relics and bashed some $ to celebrate. (no screeching, my voice was horse, and I was all out of fruit to throw)

    Ok, after this, I had to install the vBulletin files. This is another point that wasn't too clear to me, but thanks to people posting here, we have some more information for you, my fellow monkeys.

    IF you're just restoring your database, and have already installed and configured your preferred version of vBulletin, you should be done. Your database is restored, your files are already there, happy posting!

    IF you're upgrading your previously installed vBulletin, from vBulletin 2.x or one of the beta or RC 3.0, you should follow the excellent help in http://www.vbulletin.com/docs/html/ under 'upgrading'. The official documentation is not as silly as mine, but that will probably be a welcome relief.

    If you are restoring this database to a new server location, and do NOT have vBulletin files uploaded to your server yet, then at this point you should also read http://www.vbulletin.com/docs/html/ -- and follow the directions for an upgrade. Haakon wrote below:

    Originally posted by Haakon
    I can confirm that this works. I was upgrading and moving at the same time.
    -Upgraded to vB3 at first server
    -Did a mysql dump
    -Copied vB3 to new server
    -Restored the database at the new server
    And then it was up after deleting install.php and configuring config.php as mentioned.
    Alright, that should take care of it! And remember, BASH your $$!
    Last edited by phenomenon; Tue 23 Mar '04, 10:01am.
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2


    Just as a reference point

    Comment

    • phenomenon
      Member
      • Sep 2003
      • 61
      • 2.3.2

      #3
      yep. that's one of those pages that I re-read a thousand times hoping that I'd see something new. Thanks Floris!

      Comment

      • Haakon
        Senior Member
        • Jan 2001
        • 200

        #4
        Originally posted by phenomenon
        Greetings,

        AS FOR THE BASS-ACKWARDS WAY OF INSTALLING VB3, THEN DROPPING THE DATABASE...
        I welcome comments on how it's supposed to work if you have a working database and just need to install vbulletin. It may be as easy as copying the files up to the server, deleting install.php, making sure to fill in config.php, and being done with it. I don't know, though, because I didn't try it and I refuse to give you untested solutions.
        I can confirm that this work. I was upgrading and moving at the same time. -Upgraded to vB3 at first server
        -Did a mysql dump
        -Copied vB3 to new server
        -Restored the database at the new server
        And then it was up after deleting install.php and configuring config.php as mentioned.

        Comment

        • phenomenon
          Member
          • Sep 2003
          • 61
          • 2.3.2

          #5
          Great Haakon!

          I just tried something very similar myself, and except for some templates problems I've posted elsewhere that may just be my own problem, it worked for me. I will edit my post. Thanks again!

          Comment

          • lifesourcerec
            Senior Member
            • Mar 2002
            • 120

            #6
            what if the file is a *.gz file. How you restore that?

            Comment

            • Steve Machol
              Former Customer Support Manager
              • Jul 2000
              • 154488

              #7
              If this was a backup made with CPanel, then use CPanel to restore it. Otherwise you can use a compression program that works with gzip files.
              Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
              Change CKEditor Colors to Match Style (for 4.1.4 and above)

              Steve Machol Photography


              Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


              Comment

              • lifesourcerec
                Senior Member
                • Mar 2002
                • 120

                #8
                Originally posted by Steve Machol
                If this was a backup made with CPanel, then use CPanel to restore it. Otherwise you can use a compression program that works with gzip files.
                Too big for Cpanel. compressed database is 60.6 megs. The max for them is 51.2 megs. It times out like phpMy Admin

                Comment

                • Steve Machol
                  Former Customer Support Manager
                  • Jul 2000
                  • 154488

                  #9
                  Like I said if the backup was made with CPanel, then the way to restore it is with CPanel. I have done this with an 80Mb database and it worked perfectly.

                  If it was not made with CPanel, then you need to uncompress this file and restore via the command line:

                  Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                  Change CKEditor Colors to Match Style (for 4.1.4 and above)

                  Steve Machol Photography


                  Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                  Comment

                  • lifesourcerec
                    Senior Member
                    • Mar 2002
                    • 120

                    #10
                    Originally posted by Steve Machol
                    Like I said if the backup was made with CPanel, then the way to restore it is with CPanel. I have done this with an 80Mb database and it worked perfectly.

                    If it was not made with CPanel, then you need to uncompress this file and restore via the command line:

                    http://www.vbulletin.com/docs/html/m...ce_ssh_restore
                    Working on restoring original database now. Once it's done, I'll let you know the error I get with attachment.

                    Comment

                    • white_2kgt
                      Senior Member
                      • Oct 2003
                      • 108

                      #11
                      Originally posted by lifesourcerec
                      what if the file is a *.gz file. How you restore that?
                      gzip -d backupName.sql.gz

                      this will make a file called backupName.sql and then you follow the steps above. if you don't have gzip you can use winzip to open it and extract it, then upload to your host and follow the steps above, this assumes you have shell access to the server.

                      -c

                      Comment

                      • PhanTuhC
                        Member
                        • Apr 2002
                        • 37

                        #12
                        How do you restore it back with CPanel?

                        Comment

                        • Steve Machol
                          Former Customer Support Manager
                          • Jul 2000
                          • 154488

                          #13
                          You can only restore via CPanel if the backup was made with CPanel. And the place to do this is the same place you went to make the backup.
                          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                          Change CKEditor Colors to Match Style (for 4.1.4 and above)

                          Steve Machol Photography


                          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                          Comment

                          • testpig
                            Member
                            • Nov 2003
                            • 42
                            • 3.5.x

                            #14
                            OK......I am kinda almost there but.....

                            Hi all.
                            I've found the manual and this thread to be of HUGE benefit (picks flea's).
                            I have a couple of questions which are probably due to the amazing amount of stuff that I DONT know

                            First.....I've stumbled my way thru shell and done a dump of my old database but the program scrolls a heap of data for about a minute and then freezes. (this is only a smallish DB....pruned to less than 4MB). I'm a little comcerned that I havent got all the info?

                            Second.....out of sheer frustration (and the fact that I was totally out of banana's) I tried to restore the possibly incomplete dump to see what I ended up with. When I entered the command line in shell (mysql -u username -p databaseName < /path/to/your/backupName.sql ) I get


                            Error at line1: Unknown command '\1'

                            Last time I got this was when I entered the command wrongly so it was a fair cop, but I've checked my spelling and mysql is definately spelt mysql! Any thoughts???? or any peanuts??? Banana's are starting to get to me and I dont understand why we have to eat them to upgrade the board, but I'm following this thread to the letter so its a small price to pay

                            Thanks for your help,

                            snappy,
                            slick6packs.com

                            Comment

                            • testpig
                              Member
                              • Nov 2003
                              • 42
                              • 3.5.x

                              #15
                              OK.....like all good monkeys I cant stop playing with it.......so I've fixed SOME of the problem. I was using a shell client that was provided on my server. I downloaded Putty and the backup has now run as good as gold (no freezing ) so problem number 1 is gone.

                              BUTTTT..................

                              I'm still getting the unknown command error when I try and restore the backup file to the new database

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...