MYSQL command to take a backup of the database in Redhat linux 7.2


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users MYSQL command to take a backup of the database in Redhat linux 7.2
# 1  
Old 01-20-2004
MYSQL command to take a backup of the database in Redhat linux 7.2

I am new to mysql database ,

we have a mysql database running on linux , and we use mysql database for bugzilla, so we wanted to take a backup .

what is the command for taking the entire database backup
from the command prompt with all options.


Thanks in advance
Bache Gowda
# 2  
Old 01-20-2004
Hi,

Use the mysqldump command...

The argument for a full backup is -A... do mysqldump --help.
# 3  
Old 01-21-2004
Quote:
Originally posted by jsilva
Hi,

Use the mysqldump command...

The argument for a full backup is -A... do mysqldump --help.
Thanks, my another problem is how to make sure backup file is proper or not.
I userd the command to take backup us mysqldump -A -p --password=***** >back.sql

backup.sql file created but file having lot of junk character. How to make sure?

Bache Gowda
# 4  
Old 01-21-2004
It's not suppose to have "junk", because it's a text file... maybe the command is corrupted or you have some weird data on your tables...
Use mysqlcheck to check your DBs before the dump...
# 5  
Old 01-21-2004
Here is a way to email a backup using bash, perl, and crontab.

mysqlbackup

Code:
#!/bin/sh 
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql 
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql 
cd /sqldata/ 
tar -zcvf sqldata.tgz *.sql 
cd /scripts/ 
perl emailsql.cgi

Use perl to send a MIME email.

emailsql.cgi

Code:
#!/usr/bin/perl -w 
use MIME::Lite; 
$msg = MIME::Lite->new( 
From => 'mysqlbackup@yoursite.com', 
To => 'you@yoursite.com', 
Subject => 'sqldata.tgz MySQL backup!', 
Type => 'text/plain', 
Data => "Hi You,\n MySQL database backups.");
 
$msg->attach(Type=>'application/x-tar', 
Path =>"/sqldata/sqldata.tgz", 
Filename =>"sqldata.tgz"); 

$msg->send;

Use crontab -e to edit your schedule to run at 2 am every day.

0 2 * * * * /myscripts/mysqlbackup
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Increase command length for ksh shell on Redhat Linux

I have a ksh shell script and i need to pass arguments which are generated by data pulled from a database. When the argument to the shell script is too long (about 4000 charecters) the below is the issue observed. I copy the command which is 4000 charecters long from the logs and paste it... (7 Replies)
Discussion started by: mohtashims
7 Replies

2. Shell Programming and Scripting

Linux backup command line or live cd?, what do you use?

Linux backup command line or live CD?, what do you use? (4 Replies)
Discussion started by: kaja
4 Replies

3. Shell Programming and Scripting

How to backup a particular Database in MYSQL?

Hi All, Thanks in Advance!! How to backup a particular Databases..through Bash script!! For example i have 6 databases; Anish linux Software Questions Rhce Google these are the databases i have from that i want to take "Anish" and "questions" database backup regularly.... (4 Replies)
Discussion started by: anishkumarv
4 Replies

4. Linux

Linux System Backup Command

Hi All, Is there any command to take complete system backup (image) in Linux like mksysb command in AIX ? Regards (1 Reply)
Discussion started by: m_raheelahmed
1 Replies

5. UNIX for Dummies Questions & Answers

Redhat linux command to check Version

Hi All, I need to know RedHat linux version installed on a different servers. I know uname -a or /proc/version Is any other command to know the Linux version???? When we telnet to any of the Linux server, the version shows very clearly like Red Hat Enterprise Linux ES release 3 (Taroon... (1 Reply)
Discussion started by: bache_gowda
1 Replies

6. UNIX for Dummies Questions & Answers

command(s) to find size of mysql database?

hello, i'm trying to figure out the size of a mysql database shelling into my server with putty / command line. is there / are there any commands that will return the size of a database, in MB? thanks. (4 Replies)
Discussion started by: sbourgeois
4 Replies

7. UNIX for Dummies Questions & Answers

mysql in redhat

Does anyone know how to get mysql up and running with the installed version that comes with redhat linux? I've spent hours with no progress. Thank you (13 Replies)
Discussion started by: gparsons70
13 Replies
Login or Register to Ask a Question