Announcement

Collapse
No announcement yet.

Stuck on putty database backup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stuck on putty database backup

    Ok so it's probably not that hard but I just can't get it and not through lack of trying either - but it's starting to drive me crazy now so I need to ask for help

    I have downloaded putty to backup my database as it's too big for phpmyadmin anymore ...

    open the session no worries with IP and then I run

    mysqldump --opt -u user -p dbname > {path}/backup.sql

    So lets assume my database is called A
    my user in the database is called B
    my cpanel password is called C
    my user in the database password is called D

    am I writing it correctly

    mysqldump --opt -u B -pA > backup.sql

    is that right??

    and then when it comes up asking for a password am I putting in D??

    I just seem to be going in circles and confusing myself

  • #2
    For an example, text that needs to be changed will be in red:


    mysqldump --opt -Q -uUSERNAME -pPASSWORD DATABASENAME > backup.sql

    If you don't want to supply your password, don't enter it (leave the red part blank). After the you hit enter you'll be promted for to enter the password.

    Comment


    • #3
      It took me a while to actually get it work myself because I wasn't quite understanding the instructions very well.

      mysqldump --opt -Q -u dbusername -p databasename > backupname.sql

      To use your A B C D variables in the example.

      Start Putty. I presume you already set up your account's IP address and all that. So, type your account's log in name. Press enter/return. Then type that account's password and press enter/return.

      You should now be logged in and at a prompt of some sort. Enter:

      mysqldump --opt -Q -u B -p A > backupname.sql

      Enter your D. (The database user's password.)

      For "backupname.sql" I usually use the Database's name and the date like this.

      DatabaseName20090516.sql

      Anyway, this puts a copy of your database above or outside of your account's root directory. Not inside your public_html directory, (which would be bad, btw), but in the same directory that the public one is in.

      Oh, I find it easier to set up the mysqldump thingy and have the passwords and everything else ready ahead of time. Then I copy from the text file, switch to putty and paste it in then hit enter.

      Pasting is weird with putty. You paste it in by just right clicking in the putty window. At least, that's how it works for me.

      Then just wait until you get the prompt back. After that, typing "exit" and pressing enter/return gets logs you out.

      I hope this post isn't too confusing. If so, someone else may have to step in.

      -=-

      Edit: Oops! Oh, hi there, Zachery! *Tip-toes away.*

      Comment


      • #4
        No spaces, you should enter the command EXACTLY HOW IT IS.

        eg:
        Code:
        mysqldump --opt -Q -uzachery -p123456789 forum > backup.sql

        Comment


        • #5
          Cool thanks so much for your help guys

          I'll try it now

          Comment


          • #6
            I suck at this obviously

            Tried doing it again now and got the error

            Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect

            Is this something I'm doing - or should I be contacting my webhosting company?

            Comment


            • #7
              Whats your server name in your config.php file?

              Comment


              • #8
                localhost

                Comment


                • #9
                  I ended up contacting my webhosting place as I wondered about the whole remote mysql server and stuff - and yep that's what it was

                  So that's cool just had to add the h servername first before the -u

                  and yay now it works

                  haha hope it's not as confusing when I go to try and restore a database that has been backed up with putty

                  Thanks heaps for your time and help Wolfegar and Zachery
                  and thanks heaps Wolfegar for your pasting tip in putty - that saved me loads of time

                  Comment


                  • #10
                    You're welcome, nzjo. Happy to have been of some help.

                    Comment

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