3

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.

0

2 Answers 2

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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