Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I m using following sql query for creating db backup

mysqldump -u[username] -p[password] -h[hostname] [database] | gzip > [backup file path]

This generates zipped .sql file in path specified but instead of containing sql dump it contains following comment in it everytime

-- MySQL dump 10.13  Distrib 5.5.23, for Linux (x86_64)
--
-- Host: localhost    Database: zm3_quizzes
-- ------------------------------------------------------
-- Server version   5.5.23-55

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

Why this is happening and how do I get backup of my database?

Thanks in advance.

share|improve this question
add comment

2 Answers 2

If all you are getting is the header of the mysqldump, an error must be posted somewhere. In order to make the errors show up on demand, please run the dump like this:

mysqldump -u[username] -p[password] -h[hostname] zm3_quizzes 2>zm3_quizzes.err | gzip > [backup file path]

This should post the stderr of the mysqldump to zm3_quizzes.err.

share|improve this answer
add comment

I think what you need to do is:

mysqldump -u[username] -p[password] -h[hostname] --databases [database] | gzip > [backup file path].sql.gz

or

mysqldump -u[username] -p[password] -h[hostname] --all--databases | gzip > [backup file path].sql.gz

let me know if it solved your problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.