Jump to content

[Share-Script]Backup your Database | .bat Script!


Stealth

Recommended Posts

 

This is the script I have created:

 

:start
@echo off
color 1f

::   SCRIPT BY STEALTH  ::
:: License:
:: - You can modify and use this software for free
:: - You may not sell it or rent it!
:: Licensed under GNU Public License.

:: Variables by Stealth ::

REM Database Variables - SHOULD BE CHANGED

set host=localhost	
set database=l2jdb
set user=root	
set passw=

REM MySQL Variables

set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe

REM Path , Saving Variables

set SavePath=%cd%\

REM Loaded Variables

@echo #############################
@echo #Database Backup Script v1.0#
@echo #############################
@echo #    Coded by Stealth       #
@echo #############################
@echo.
@echo.
@echo Do you wish to make a backup?
set /p make=(y/n):
If %make%==y goto new_backup
If %make%==n goto mxc
goto start

:mxc
@echo Please take some time to visit:
@echo www.MaxCheaters.com
@echo.
@echo Do you wish to visit now?
set /p visit=(y/n):
If %visit%==y start www.maxcheaters.com
If %visit%==n exit

:new_backup
@echo Creating New Backup...
@echo Output directory: %SavePath%
@echo.
@echo Please specify a name for your backup:
set /p name=Backup Filename:
@echo.
@echo Saving...
%MySQLdumpPath% --add-drop-table -h %host% -u %user% --password=%passw% %database% > %name%.sql
@echo.
@echo File %name% created!
@echo.
Echo Thank you for using [Database Backup Script v1.0] by Stealth
echo.
echo Press a key to exit (Goodbye)...
pause>nul
exit

 

Copy it to file with .bat extension and your done!

 

- PS: Dont forget to set the variables:

 

set host=localhost	
set database=l2jdb
set user=root	
set passw=
set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe

 

Variables Explained:

 

set host=

The host pc that runs the database (default : localhost)

set database=

The database name (default : l2jdb)

set user=

Database username (default : root)

set passw=

The database password (default is blank or "root" without the quotes)

set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe

The directory which has mysqldump.exe file (default for MySQL Server 5.1 is the one i entered)

 

Credits to me , and some code taken from database installers so credits also to L2JFree & TaneL

 

Compiled Batch Script:

http://www.4shared.com/file/90025800/db86bb4/Backup.html

 

 

Link to comment
Share on other sites

Wreos ,ty an boreis na to kaneis na kanei back up aytomata kathe  5 ores p.x tha itan kalitero

 

Please speak english its L2J Develop Section and we should speak english

 

- BTW I will try to make have autobackup every 10 - 12 hours or so and repost the new version here.

Link to comment
Share on other sites

I will try to make have autobackup every 10 - 12 hours or so and repost the new version here.

 

Do This And You Have +1 From me.

 

btw , it rox. cool for people that are bored to backup manually! xD

 

p.s: try to create the auto one! xD

Link to comment
Share on other sites

Please speak english its L2J Develop Section and we should speak english

 

- BTW I will try to make have autobackup every 10 - 12 hours or so and repost the new version here.

Nice, i looking in greek section and i confused :P i edit my post.

Link to comment
Share on other sites

Do This And You Have +1 From me.

 

btw , it rox. cool for people that are bored to backup manually! xD

 

p.s: try to create the auto one! xD

 

@OFF Topic: If you use navicat, then there is one option which creates auto backups ;)

 

@ON Topic: Gratz. One more nice share.

Link to comment
Share on other sites

omg excellent share! keep it up!

 

about the timer to do it every 10-12 hours. i wont use any batch file to do that. just use Scheduled tasks. (Control Panel -> Scheduled tasks)

 

or just download and install the Sleep command for MS-DOS and the edit the script.

 

 

 

 

@echo off
set host=localhost	
set database=l2jdb
set user=root	
set passw=

REM MySQL Variables

set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe


set SavePath=%cd%\

set name=1
:backup
%MySQLdumpPath% --add-drop-table -h %host% -u %user% --password=%passw% %database% > %name%.sql
set /a name=name+1
Sleep 43200
goto backup

 

Link to comment
Share on other sites

Thanks,but why using this when navicat gives you the option?

If someone does not use navicat then he has this option.

Also if he doesn't want to pay to buy navicat this file is provided for free. (Assuming he won't be using any cracks ,serials etc for navicat if he owns a big server)...

 

* Topic Locked *

 

- New Release is coming!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...