MYSQL table backups

Hi everyone,

I am having a little bit of trouble backing up some mySQL tables. I’ve
been trying to adapt a script I found on the internet at . However, i
have been having trouble (under bash) on getting it to work.

I know my mysql account has full privileges to all account information.
Using the script below, it even prints out all the table names,
however, when I run this script through the terminal, I get an odd
error saying “mysqldump: error 1044: access denied for user
‘USERNAME’@’localhost’ to databse ‘?add-drop-table’ when selecting the

It shouldn’t be a privileges problem, and because it loops through
every database, I know the script can see every table, but it cannot
dump out the contents of each.

Anyone have a suggestion or alternative?

Thanks much!

# MYSQL Backup Script
# Contains portions of code from

export d=$(date +’%Y-%m-%d’)
export savepath=’/home/idyllico/archive/mysql’
export usr=’USERNAME’
export pwd=”PASSWORD”

echo “mySQL Backup Script”

mkdir -p $savepath/$d

echo “Dumping entire database..”
mysqldump -add-drop-table -allow-keywords -all-databases -u$usr
-p$pwd > $savepath/$d/all.sql

echo “Dumping individual tables…”

for a in `echo “show databases”

Leave a Reply

Your email address will not be published. Required fields are marked *