Mysql database dump gives almost empty file

Hi,

I'm trying to get a daily dump of a mysql database on a windows server using this code in a .bat file:

@echo off
echo Running dump...
set curDate=
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined curDate set curDate=%%x
set "day=%curDate:~6,2%"
"D:\wamp\bin\mysql\mysql5.5.8\bin\mysqldump" --host="localhost" --user="root" --password="mysql" database> "D:\wamp\database-backups\backupDay.%day%.sql"
echo Done!

Open in new window


The output only contains:

-- MySQL dump 10.13  Distrib 5.5.8, for Win32 (x86)
--
-- Host: localhost    Database: database
-- ------------------------------------------------------
-- Server version	5.5.8-log

/*!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 */;

Open in new window


Why isn't the whole database dumped? The script works on my localhost.

Help welcome :)
Thanks!
peps03Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KimputerCommented:
When running this batch file (or maybe test only that mysql command in a commandbox), what does it return (success or error message?)
0
peps03Author Commented:
i have no idea, the window is closed in a blink...
0
KimputerCommented:
That's why you have to open a cmd box (Start > Run > cmd (enter)
Then type or copy & paste:
"D:\wamp\bin\mysql\mysql5.5.8\bin\mysqldump" --host="localhost" --user="root" --password="mysql" database> "D:\wamp\database-backups\backupDay.xxxxxx.sql"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

peps03Author Commented:
Ah, i get error:

error 1044 access denied for user USERNAME to database DATABASE when using lock tables
0
KimputerCommented:
Again, do the same, but with:

"D:\wamp\bin\mysql\mysql5.5.8\bin\mysqldump" –-single-transaction --host="localhost" --user="root" --password="mysql" database> "D:\wamp\database-backups\backupDay.xxxxxx.sql"
0
peps03Author Commented:
got error 1044 access denied for user USER@localhost to database DATABASE '?-single-transaction' when selecting database
0
peps03Author Commented:
Sql output:

-- MySQL dump 10.13  Distrib 5.5.8, for Win32 (x86)
--
-- Host: localhost    Database: –-single-transaction
-- ------------------------------------------------------
-- Server version	5.5.8-log

/*!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 */;

Open in new window

0
KimputerCommented:
My error when typing.

make sure the new command I inserted has TWO normal dashes --
It's the one between 0 and = on the keyboard.

"D:\wamp\bin\mysql\mysql5.5.8\bin\mysqldump" --single-transaction --host="localhost" --user="root" --password="mysql" database> "D:\wamp\database-backups\backupDay.xxxxxx.sql"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peps03Author Commented:
Wow! That worked!!!
0
peps03Author Commented:
Thanks a lot!
What does your command do exactly?
0
KimputerCommented:
It's quite technical, but if you're up for it, read it here: https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_single-transaction
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.