Help needed for mysqldump command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed for mysqldump command
# 1  
Old 01-20-2010
Help needed for mysqldump command

I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command:
Code:
mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log

Is there anything wrong with the syntax?

---------- Post updated at 08:32 PM ---------- Previous update was at 08:32 PM ----------

Detected the error.
This will create an empty file called mysql-daily-backup.sql and the full SQL dump will go to /tmp/backup_log/mysql.log. So i modified it to:
Code:
(mysqldump –v -A --add-drop-table > mysql-daily-backup.sql) &> /tmp/backup_log/mysql.log

Serves my purpose now.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help with automatically Import from special mysqldump

Hi @ all I need a little bit help with a tricky problem ... Here´s the situation: We´ve 2 MySQL-Servers, one is productive, the other is Backup. At the productive Server there runs every 2 hours a cron Job which does a Dump from MySQL-DB with script 'automysqlbackup.sh' and copy it then... (7 Replies)
Discussion started by: jackcracker
7 Replies

2. Shell Programming and Scripting

Mysqldump rotate backup

I have a very simple script that uses a cron job to take a daily backup of our orders database. echo "Dumping ORDERS database"; mysqldump -u root --password='mypassword' -h '1.1.1.1' --opt --compress ORDERS $tbl_names > /Volumes/Files_Backup_1/db_backups/orders.sql echo "Copied database to... (2 Replies)
Discussion started by: timgolding
2 Replies

3. Shell Programming and Scripting

Modification of MySQLDump-files before compression needed

Hi @all! In my MySQL-backup-script I backup and compress every single table with this command: /usr/bin/mysqldump --opt database_x table_y | /usr/bin/pbzip2 -c > "/media/BackUpDrive/Backup/table_x.gz"Unfortunately these files need modification - they have to start with the following line(s):... (7 Replies)
Discussion started by: gogo555
7 Replies

4. UNIX for Dummies Questions & Answers

Mysqldump certain tables

Hi, I have to upload part of my database periodically when i make changes to product data etc. However I only want to upload certain tables. We suffer from bandwidth chock here, so i want to write a couple of separate scripts that upload parts of the database that changed. The database is large... (5 Replies)
Discussion started by: timgolding
5 Replies

5. UNIX for Dummies Questions & Answers

Problem with my crontab file, using mysqldump

My crontab file tells cron to run a certain shell script at 10:30 AM every day. The shell script backs up my database with mysqldump and then runs a sed script that does some editing of the backup file. I have programmed the shell script to write an error message to a file I have in my home... (1 Reply)
Discussion started by: Ultrix
1 Replies

6. UNIX for Advanced & Expert Users

mysqldump slowing down the process?

Hi All, I have a data calculation process-a perl script running each and every hour which will do some calculations on the data stored in a mysql server. Normally it tooks around 2minutes (max) to complete. But in case if i did any actions on the linux box where the database is... (7 Replies)
Discussion started by: DILEEP410
7 Replies

7. UNIX for Dummies Questions & Answers

mysqldump bus error - cored dumped

hi, I need to backup a database but I'm getting the error "bus error - core dumped" just after I run mysqldump command. The server has installed solaris 9. Any help would be appreciated (3 Replies)
Discussion started by: dahr
3 Replies

8. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies
Login or Register to Ask a Question
MYSQL(1)						      General Commands Manual							  MYSQL(1)

NAME
mysql - text-based client for mysqld, a SQL-based relational database daemon SYNOPSIS
mysql [-B|--batch] [-#|--debug= logfile] [-T|--debug-info] [-e|--exec= command] [-f|--force] [-?|--help] [-h|--host= hostname] [-n|--unbuffered] [-p[pwd]] [--password=[pwd]] [-P|--port= pnum] [-q|--quick] [-r|--raw] [-s|--silent] [-S|--socket= snum] [-u|--user= uname] [-v|--verbose] [-V|--version] [-w|--wait] DESCRIPTION
The mysql program provides a curses-based interface to the SQL-based database server daemon, mysqld(1). Full fuller documentation, refer to the HTML documents installed with the package. OPTIONS
-B|--batch Print results with a tab as separator, each row on a new line. -#|--debug=logfile Employ the specified debug log. -T|--debug-info Print debug information upon exiting. -e | --exec=command Execute the specified command and quit (--batch is implicit). -f|--force Continue even if the face of a SQL error. -?|--help Display a help message and exit. -h|--host=hostname Connect to the specified host. -n|--unbuffered Flush the buffer after each query. -p|--password[=pwd] Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interac- tively. -P|--port=pnum Employ the specified port number for connecting to the database server. -q|--quick Do not cache the result; print it row by row. This may slow down the server if the output is suspended. -r|--raw Write fields without conversion. (used with --batch). -s|--silent Silent mode: reduce the amount of output. -S|--socket=snum Employ the specified socket file for connecting to the database server. -u|--user=uname Employ the specified user name for logging in to the server. -v|--verbose Verbose mode: write more Specifying this option twice produces a tabular output format. -V|--version Print the mysql version number and exit. -w|--wait Wait and retry if the database server connection is down. FILES
/depot/bin/mysql executable /depot/bin/mysqld executable /depot/bin/safe_mysqld executable shell script for starting mysqld safely /site/var/mysql/data location of database files EXAMPLE
You can also read a backup dump file back into MySQL with: mysql database < backup-file.sql SEE ALSO
isamchk (1), isamlog (1), mysqlaccess (1), mysqladmin (1), mysqlbug (1), mysqld (1), mysqldump (1), mysqlshow (1), msql2mysql (1), perror (1), replace (1), safe_mysqld (1), which1 (1), zap (1), AUTHOR
Ver 6.3, distribution 3.20.20 Michael (Monty) Widenius (monty@tcx.se), TCX Datakonsult AB (http://www.tcx.se). This software comes with no warranty. Manual page by R. P. C. Rodgers, Lister Hill National Center for Biomedical Communication, U.S. National Library of Medicine (rodgers@nlm.nih.gov). 13 June 1997 MYSQL(1)