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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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?)
peps03Author Commented:
i have no idea, the window is closed in a blink...
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"
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

peps03Author Commented:
Ah, i get error:

error 1044 access denied for user USERNAME to database DATABASE when using lock tables
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"
peps03Author Commented:
got error 1044 access denied for user USER@localhost to database DATABASE '?-single-transaction' when selecting database
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

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"

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!!!
peps03Author Commented:
Thanks a lot!
What does your command do exactly?
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
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.