Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home MySQL MySql backup database with gzip compression

MySql backup database with gzip compression

This example will help you know how to backup one or multi MySQL database using mysqldump command. If your database is very big, you may need to compress the backup sql file. To do that, you can use gzip compression to pipe the output to gzip then you will get the output as gzip file.

1. Backup one database from Command Line using mysqldump

mysqldump -u root -p your_mysql_database_name > your_mysql_database_name.sql

mysqldump -u root -p your_mysql_database_name > your_mysql_database_name.sql

The command above assumes that you would like to backup the database your_mysql_database_name into a file called your_mysql_database_name.sql with MySQL root account.

2. Backup multi databases from Command Line using mysqldump

mysqldump -u root -p --databases database1 database2 database3 > database1_database2_database3.sql

mysqldump -u root -p --databases database1 database2 database3 > database1_database2_database3.sql

The command above assumes that you would like to backup 3 databases database1,database2 and database3 into a file called database1_database2_database3.sql with MySQL root account.

3. Back certain of tables from Command Line using mysqldump

mysqldump -u root -p your_mysql_database_name table1 table2 table3 > table1_table2_table3.sql

mysqldump -u root -p your_mysql_database_name table1 table2 table3 > table1_table2_table3.sql

The command above assumes that you would like to backup 3 tables: table1, table2 and table3 from database your_mysql_database_name into a file called table1_table2_table3.sql with MySQL root account.

4. Backup with GZIP compression

mysqldump -u root -p your_mysql_database_name | gzip -9 > your_mysql_database_name.sql.gz

mysqldump -u root -p your_mysql_database_name | gzip -9 > your_mysql_database_name.sql.gz

mysqldump -u root -p --databases database1 database2 database3 | gzip -9 > database1_database2_database3.sql.gz

mysqldump -u root -p --databases database1 database2 database3 | gzip -9 > database1_database2_database3.sql.gz

mysqldump -u root -p your_mysql_database_name table1 table2 table3 | gzip -9 > table1_table2_table3.sql.gz

mysqldump -u root -p your_mysql_database_name table1 table2 table3 | gzip -9 > table1_table2_table3.sql.gz

Commands above will compress the backup files with GZIP compression. It will reduce the volume of your backup files.

Note: you should be asked to enter your mysql account password, once you enter the password just key in your database password and you are done after minutes 🙂

If you need to know how to restore your mysql database, read this post

Mar 6, 2011Hoan Huynh
PHP display all errors and warnings Mysql restore database from dump file with GZIP compression
You Might Also Like:
  • Mysql restore database from dump file with GZIP compression
  • Schedule Backup And Zip MySQL Database In Windows
  • Shell script backup all Mysql Databases in Linux
  • MySQL dump table
  • Change or reset MySQL Root Account Password
  • Step By Step Upgrade Piwik From 1.2 To 1.4
  • MySQL Incorrect Data Type Value In Column
  • Install LAMP (Apache, MySQL and PHP in Linux) on CentOS
  • Where MySQL Data Dir And Innodb Data Home Dir Location
  • PHP Store Session In MySQL Database
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

10 years ago MySQLbackup database, gzip, mysqldump338
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,237 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,087 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,872 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,343 views
C# Read Json From URL And Parse/Deserialize Json
9,851 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Term Papers – Easy to Take Care of
  • How to Write Term Papers in Online Tutorials
  • How to Plan Writing an Essay
  • How to Apply For a Payday Loan With Bad Credit
  • Statistics For Sale – How To Compose One
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (123)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development