My SQL Backups


#1

Trying to dump an archive of my MYSQL db using the instructions from the wiki with the following in the shell script

#!/bin/bash
cd /home/user/backups/
mkdir mysql
suffix=$(date +%y%m%d)
mysqldump --opt -udbuser -pdbpass -h mysql-host.domain dbname > mysql/db_user.$suffix.sql
tar -cf archives/user_db_backup.$suffix.tar mysql/*
rm -r mysql/

and for some reason when I run it from the ssh command line I get

mysqldump: Got error: 1045: Access denied for user ‘dbuser’@‘twizzler.dreamhost.com’ (using password: YES) when trying to connect

And yet the ‘valid’ user credentials I am passing work fine, I can connect using

mysql -hmysql-host.domain -udbuser -p

and entering the password.

So what gives? I’ve tried a search of the forums and nothings obvious.

TIA uk-Tony


#2

DOH!!

Just looked again at the script, and was using the wrong dbuser name, changed that in teh script and all is working . . . Now to set it up to GZip it as well :slight_smile: