Announcement

Collapse
No announcement yet.

how to back up

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

  • [Forum] how to back up

    Sorry for being a bit thick, but I'm struggling to find a clear and simple guide showing you how to back up your database. Can anyone point me in the right direction.
    Gardening

  • #2
    Originally posted by cheeseplant View Post
    Sorry for being a bit thick, but I'm struggling to find a clear and simple guide showing you how to back up your database. Can anyone point me in the right direction.
    You can backup your db in several different methods. If you have ssh access, you can back up The Database via SSH/Telnet.

    Quoted from the online manual how to do this:

    Backing Up The Database via SSH/Telnet In order to back up your database via SSH or Telnet you will require 2 things:

    1) SSH or Telnet access to your site. You will need to check with your hosting company to see if this is available.

    2) An SSH/Telnet Client, such as PuTTy.

    Open your SSH/Telnet client and log into your website. The command line prompt you will see will vary by OS.
    For most hosting companies, this will bring you into the FTP root folder.

    Type in the following to create a backup in the current directory:

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

    Or to create a backup in a separate directory (signified by /path/to/) type:

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

    You will be prompted for the database password. Enter it and the database will backup.

    If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

    Current directory:

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

    Separate directory:

    mysqldump --opt -Q -h servername -u dbusername -p databasename > /path/to/backupname.sql

    You can then, if you wish, download the backup to your home computer.
    Other methods would be via phpmyadmin which usually can be found at the cp of your host. But if you have a large database then it would be best to use mysqldumper instead as most hosts set a file size limit on in their servers.

    Hope it helps.

    Comment


    • #3
      Thanks borbole, I'd never heard of SSH or Telnet before. I would need to use the phpmyadmin though as I would need to upgrade with my host to use the SSH method. Do you know where I can find this method too?
      Gardening

      Comment


      • #4
        Do you mean phpmyadmin? Usually it can be found in the CP of your host.

        Comment


        • #5
          Depending on the size of your DB phpmyadmin may not work for you. My host limits it to like 20MB thus I use mysql dumper. Just download the files, upload to your server, run the install script, then you can do a backup no problem.

          Comment


          • #6
            If your host has given you cPanel, then the cPanel option titled Backup Wizard is a breeze.

            DAVID COPELAND
            Licensed VB Holder Since 2000
            Celebrating 20 Years with VB

            Comment


            • #7
              I've had another look on my host and can't find anything on cPanel. I've found these instructions though on backing up databases (for smaller databases like mine)

              "The following PHP Script will backup the content of a MySQL database in a GZip file:

              <?php
              // Enter Database access details
              $host= 'dbxx.oneandone.co.uk';
              $user= 'dbxxxxxx';
              $pass= 'xxxxxxxx';
              $db= 'dbxxxxxxx';

              // Instructing the system to zip and store the database
              system(sprintf(

              'mysqldump --opt -h%s -u%s -p%s %s | gzip > %s/dumpDB.sql.gz',
              $host,
              $user,
              $pass,
              $db,
              getenv('DOCUMENT_ROOT')
              ));
              echo '+DONE';
              ?>


              After you have run the script you can download the dump file by using FTP or the WebSpace Explorer"

              I'm assuming, (probably wrongly) this is done in a form provided by the host, but this isn't clear. If not how do you actually tell it to do this? (remember I'm a bit thick, do you need to upload a new file or post the code in an existing file, or is it something else I've missed completely)?
              Last edited by cheeseplant; Sun 28 Feb '10, 1:57am. Reason: additional detail
              Gardening

              Comment


              • #8
                I found this on http://fragments.turtlemeat.com/mysq...phpmyadmin.php


                Backup of Mysql database
                It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.
                0. Open phpMyAdmin.
                1. Click Export in the Menu to get to where you can backup you MySql database. Image showing the export menu.
                2. Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
                3. Select"SQL"-> for output format, Check "Structure" and "Add AUTO_INCREMENT" value. Check "Enclose table and field name with backquotes". Check "DATA", check use "hexadecimal for binary field". Export type set to "INSERT".
                4. Check "Save as file", do not change the file name, use compression if you want. Then click "GO" to download the backup file.
                Image showing step 2-4.
                Restoring a backup of a MySql database
                1. To restore a database, you click the SQL tab.
                2. On the "SQL"-page , unclick the show query here again.
                3. Browse to your backup of the database.
                4. Click Go.
                Image showing step 1-4.
                Gardening

                Comment


                • #9
                  check out this script
                  http://sourceforge.net/projects/automysqlbackup/

                  Comment

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