HeatWare.net header image
HeatWare.net
TwitterRSSEmail
  • Home
  • Windows
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
  • Linux/Unix
  • Mac
  • Mobile
    • Android
    • iOS
    • Phones (Help / Resources)
  • Software / Programming
    • Free Software
    • Programming – General
    • PHP
    • Ruby/Rails
    • Quality Assurance (QA)
    • Software – General
    • Software Help
    • Databases
  • Cool Websites
  • Other
    • Deals & Bargains
    • News
    • Video Games
    • Hardware
    • Electronics
  • About

2 comments / February 22, 2013 / sood / Databases

Create a compressed MySQL database dump/backup (Linux)

This may go without saying, but backing up your database regularly is important. Hard disks can fail at anytime causing you to lose all your data (We recommend using a RAID configuration when possible for data redundancy!) Often times, we may overlook the database and simply make backups of our /www or /public_html folder that contains our HTML, PHP, CSS, etc. Below is a command that even database newbies can run to backup their data:

Compressed MySQL Database Dump

mysqldump -u <DB USERNAME> --password=<DB PASSWORD> --all-databases | gzip > mysql_alldb_$(date -d "today" +"%Y-%m-%d").sql.gz

This command will dump the SQL of ALL of your databases on the server and then compress it with GZip. The file it creates will contain the datestamp (i.e.  mysql_alldb_2013-02-22.sql.gz) so that you can easily tell when it was created. Also, this command will work well in a nightly CRON job. If you have any questions, don’t hesitate to ask!

Related Posts

  • Using Linux ‘head’ command to preview a file
  • MySQL 5.6 - How to log slow queries (Linux)
  • Scripting the Linux 'passwd' command easily without interactive prompt
  • Shell command to bulk change file extensions in a directory (Linux)
  • Find PostgreSQL database size using SQL 'Select'

Linux mysql

2 comments… add one
  1. Shashank Bhattarai April 9, 2014, 5:23 am

    Hey thanks, was desperately looking forward for this 🙂 Wanted to move my database as zipped format.

  2. Stoatwblr April 23, 2014, 9:46 am

    This will only single thread gzip (which limits to about 30MB/s max).

    Use pigz for multithreaded compression of large databases.

Cancel reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Why You Should Consider Diving Apps
  • How to Buy a Smartphone that Fits Your Budget
  • How to Overcome Frustrating PDF Stress
  • Convert PDF to Word: Easy, Reliable and Quality Conversion
  • PDF to Excel App ­ – A New Way of Handling Tricky Documents

Recent Comments

  • Valarie Walter on Basic Troubleshooting Steps for your Cell Phone
  • John Mists on A Brief History of Android OS
  • syarif on PostgreSQL: How to reload config settings without restarting database
  • Raghu on How to SSH to a server using Ruby – Part I
  • francisco clemente on Basic Troubleshooting Steps for your Cell Phone

Tags

ACSLS Android Bargain Cell Phones Cool Software Cool Websites Databases Deals Ebooks Facebook Free Software G2x Galaxy S5 iOS iPhone Kindle LG Linux Linux/Unix Mac Mobile mysql Office OpenStack OS X PHP Postgres PostgreSQL ruby Samsung Galaxy S6 Shell Smartphones Sun T-Mobile Tips Tips & Tricks Ubuntu Unix Virtualization VMWare Windows Windows 7 Windows 8 Windows Vista Windows XP

Latest Tweet

Follow @HeatwaredotNet

SP
@HeatwaredotNet

  • Why You Should Consider Diving Apps https://t.co/Is41cdUv2I #diving-apps
    about 6 years ago

All Categories

Other Links

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2015 — HeatWare