Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    195

    MySQL backup script

    I would like to know if there are any good backup script availability to backup database to a remote server?

    I was using MySQLDumper, but this script is no more updated since 2011

  2. #2
    Join Date
    Sep 2002
    Location
    Georgia
    Posts
    1,822
    There are a couple of options you could consider:

    1) Backup using myslqdump:

    You could read: https://www.digitalocean.com/communi...-an-ubuntu-vps

    Detailed instructions for mysqldump: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

    2) You could use database management application such as Navicat (Multi OS) or Sequel Pro (Mac) to connect to the database remotely and export the database

    3) phpMyAdmin - You could also export the database after you log in with root
    Imagination is more important than knowledge.

  3. #3
    automysqlbackup - then rsync to remote

  4. #4
    you can use what others have suggested or you could use a simple bash script to dump all your databases to some directory using `mysqldump` and then you can `rsync` the dumps to a remote location.

    Code:
    #!/bin/bash
    #
    BACKUP_DIR=/media/backups/mysqlbackup
    MYSQL_USER='root'
    MYSQL_PASS='YOUR_PASSWORD'
    
    test ! -d "${BACKUP_DIR}" && mkdir -p "${BACKUP_DIR}"
    
    DBS_ARRAY=($(mysql -u "${MYSQL_USER}" --password="${MYSQL_PASS}" -Bse 'show databases'|grep -Ev '^database$|^mysql$|^information_schema$'))
    
    for DB in "${DBS_ARRAY[@]}"; do
        mysqldump --single-transaction --skip-lock-tables -u "${MYSQL_USER}" --password="${MYSQL_PASS}" "${DB}" > "${BACKUP_DIR}"/$(date "+%d_%h_%Y")_"${DB}".sql
    done
    this will save the dumps, in this example as

    Code:
    /media/backups/mysqlbackup/28_Jan_2014_<DB_NAME>.sql
    ---=== RoseHosting.com Admin ===---
    Linux Cloud Hosting - linuxcloudvps.com
    Linux VPS Hosting - rosehosting.com
    High Quality Linux virtual servers with lots of Guaranteed RAM and HDD space, Impeccable Service.

  5. #5
    Join Date
    Sep 2007
    Posts
    355
    Import/Export MySQL Database
    How to import/export MySQL database with exact character set on my Dedicated server?
    Exporting your database with the correct charset is important in order to avoid problems with data that has non-english characters.

    For example, if the character set of your data is Unicode (UTF8) you can use the following command to export it using this charset:

    mysqldump -uUSERNAME -pPASSWORD --default-character-set=utf8 --hex-blob DATABASE_NAME > backup.sql

    Replace USERNAME, PASSWORD and DATABASE_NAME with the appropriate values for your database and you will have a file named "backup.sql" properly encoded in UTF-8.

    When you import backup into an empty MySQL database, you can set the exact character set for the data that will be inserted. To do this, use the following command:

    mysql -uUSERNAME -pPASSWORD --default-character-set=utf8 DATABASE_NAME < backup.sql

    Replace --default-character-set=utf8 with the charset used for the creation of the backup.sql file. This will ensure that your data is inserted correctly.
    PHP | MySQL | JS | Ajax | HTML

Similar Threads

  1. MySQL Backup script?
    By Saryooo in forum Programming Discussion
    Replies: 7
    Last Post: 10-18-2005, 03:11 PM
  2. MySQL backup script help
    By DamnSkippy in forum Programming Discussion
    Replies: 6
    Last Post: 04-02-2004, 07:57 PM
  3. MySQL backup script in PHP
    By Research Names in forum Programming Discussion
    Replies: 3
    Last Post: 02-08-2003, 12:13 AM
  4. MySQL Backup script
    By Surfer in forum Dedicated Server
    Replies: 4
    Last Post: 04-14-2001, 03:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •