Looks like your full command would end up being:
mysqldump /usr/local/bin/mysql --opt -uroot -pmypassword db

which makes little sense.  (You don't need that ${MYSQL} in there).
Instead, maybe what you want is to use an environment variable for
mysqldump, a la
MYSQLDUMP="`which mysqldump 2>/dev/null`" ||
MYSQLDUMP="/usr/local/bin/mysqldump"
then later
cd ${ARCHDIR} && ${MYSQLDUMP} ${MYSQLDUMP_ARGS} > ${NAME}.`date +%Y%m%d`

Dan


On 6/29/06, Andreas Widerøe Andersen <[EMAIL PROTECTED]> wrote:
Thanks for the examples. I haven't been able to get them to work yet.

Here's what I tried:

MYSQL="`which mysql 2>/dev/null`" || MYSQL="/usr/local/bin/mysql"
MYSQL_ARGS="--opt -uroot -pmypassword db"
ARCHDIR=/backup/mysql
NAME=db_dump

# Remove archives older than 64 days
find ${ARCHDIR} -type f -mtime +64 | xargs rm -f

# Create new archives
cd ${ARCHDIR} && mysqldump ${MYSQL} ${MYSQL_ARGS} > ${NAME}.`date +%Y%m%d`

I only get:
mysqldump: Got error: 1045: Access denied for user: '[EMAIL PROTECTED]' (Using
password: NO) when trying to connect

While I can login to mysql easily with this user/pass from the command
prompt. I have also tried the specific user for this database. Same problem.

Any ideas?

Thanks,
Andreas



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to