Jump to content
  • 0

My auto backup sql's are empty!


robbiedarza

Question

Hello there, I am trying to get auto backups working on my server using this batch file:

@echo off
set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%
SET backupTime=%date:~-4,4%-%date:~-10,2%-%date:~-7,2%_%hr%-%time:~3,2%
REM echo %backupTime%
cd "C:\xampp\mysql\bin"
mysqldump.exe --user=Epoch_User --password=cheese123 --compact --replace --skip-lock-tables Epoch_Database instance_deployable instance_vehicle profile survivor > "C:\mysqlbackup\%backupTime%.sql"
REM pause

It creates an sql file, but its empty and the window that pops up when I double click it only flashes up so I cant read what it says!

 

Anyone got any ideas plz?

 

 

Cheers

 

Robbie

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

hm im doing this like that:

@echo off

REM "Create a time signature for the backup"
SET backupTime="%date:~0,2%-%date:~3,2%-%date:~6,6%_%time:~0,2%-%time:~3,2%"

REM "Dump the database to the file."
C:\mysql\bin\mysqldump -uMYUSER -pMYPASSWORD DATABASENAME > C:\mysql\backup\epoch_%backupTime%.sql
Link to comment
Share on other sites

  • 0

Hi, thanks for the relpy

 

I tried

@echo off

REM "Create a time signature for the backup"
SET backupTime="%date:~0,2%-%date:~3,2%-%date:~6,6%_%time:~0,2%-%time:~3,2%"

REM "Dump the database to the file."
C:\xampp\mysql\bin\mysqldump -uEpoch_User -pcheese123 Epoch_Database > C:\mysqlbackup\epoch_%backupTime%.sql

And it created an sql file called  epoch_12-09-2014_22-50.sql

 

It was only 1kb and when I opened it with notepad it had this inside

-- MySQL dump 10.13 Distrib 5.6.16, for Win32 (x86)
--
-- Host: localhost Database: Epoch_Database
-- ------------------------------------------------------
-- Server version    5.6.16

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

Many thanks

 

Robbie

Link to comment
Share on other sites

  • 0
@echo off
FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H) 
FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H) 
set fname=epoch_database_backup_%v_date%_%v_time%.sql 
echo %v_time% 
echo %fname% 
cd /D "D:\DATABASE_DIR\xampp\mysql\bin"
mysqldump -u root -p epoch_database --password= --result-file="E:\PLACEtoSTORE\database\%fname%"
ping 127.0.0.1 -n 5 >NUL
exit

Can't remember who originally posted this, but works nice :)

Link to comment
Share on other sites

  • 0

Hi there, thanks for that dude, it does the same thing but I can read the text this time, here is a screenshot of what it says if anyone can take a look plz

 

Got error: 1044: Access denied for user ‘root’@’localhost’ to database ‘information_schema’ when using LOCK TABLES

 

I have googled the error but i'm still struggling on how to grant lock tables to the user

 

http://imgur.com/IeDPpAc

 

 

cheers

 

Robbie

 

Edit: I got it working now thanks for the help guys, woot!

 

For anyone else who might get this error, I clicked on 'users' in the database, clicked on 'edit privilages' for the correct user and ticked the box that says 'locked tables' and clicked on 'go' in that section.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...