Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

How to Automatically or Manually backup MySQL database?

I am looking for a way to backup a MySQL database.  

Current Method:  Using PHPMYADMIN I export all tables from 'HACW_V2' to the screen.  I cut and paste the Statements to a WORD document and save.    I also have the option to save as a file.  

Goal:  Be able to backup database automatically (by whatever means you can think of), or create a link on my intranet home page that will create a backup and save it to a predetermined (or manually specified location) with only one click.  

Tools:  I currently use PHP for my intranet site.  My web server was compiled by XAMPP.

thanks for any help you are able to give.
0
drews77
Asked:
drews77
3 Solutions
 
K VDatabase ConsultantCommented:
manually:
- Using mysql-administrator Gui tool
- Using mysqldump
- Directly copying datafiles

Automatically:
- http://sourceforge.net/projects/automysqlbackup/
- If you want to make it a real simple script then:
On linux/unix system:
#create an sh file mysql_backup.sh with following line and put it in a crontab:
mysql -uroot -pPASSWORD --databases DATABASE-NAME > DATABASE_`date +%d_%m_%y`.sql
###http://en.wikipedia.org/wiki/Cron


Now about your goal: following may help as well--

http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx
http://www.geekpedia.com/tutorial43_Backup-mysql-data-using-PHP-in-Windows.html
0
 
digital0iced0Commented:
If you use their gui tools it lets you specify the dates to do backups and stuff like that under MySQL Administrator:

http://dev.mysql.com/downloads/gui-tools/5.0.html
0
 
shobinsunCommented:
Hello,

Here is an automatic backup script:

http://www.dagondesign.com/articles/automatic-mysql-backup-script/

Here is a simple script to do this:

$dbname = '*';
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$backupFile = 'back' . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);

Hope this will help you.

Regards
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now