Rhino wrote:

I have an automated backup script that has been running daily for a couple of years now. It has never given me trouble until the last two days. For the last two days, I have been getting this message when backing up my newest database:

/usr/bin/mysqldump: Got error: 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'References READ /*!32311 LOCAL */' at line 1 when using LOCK TABLES

This is the relevant portion of my backup script:

for ONE_DBNAME in `echo show databases | mysql -s -u $USERID -p$PASSWORD`
do
  echo
  echo "Backing up database" $ONE_DBNAME;
/usr/bin/mysqldump --opt --verbose -u${USERID} -p${PASSWORD} ${ONE_DBNAME} -r ${BACKUP_PATH}"/"${ONE_DBNAME}"."${BACKUP_TIMESTAMP}".sql"

I would look here. This is a dangerous expansion. A space or ';' in any of these variables my generate unwanted commands.
Use quotes around the argument to -r.
Try.
/usr/bin/mysqldump --opt --verbose -u${USERID} -p${PASSWORD} ${ONE_DBNAME} -r "${BACKUP_PATH}/${ONE_DBNAME}.${BACKUP_TIMESTAMP}.sql"

or /usr/bin/mysqldump --opt --verbose -u${USERID} -p${PASSWORD} ${ONE_DBNAME} > "${BACKUP_PATH}/${ONE_DBNAME}.${BACKUP_TIMESTAMP}.sql"

  echo ">> Deleting these old backups for this database..."
/usr/bin/find ${BACKUP_PATH} -mtime +$NUMBER_OF_DAILY_BACKUPS_TO_KEEP -name $ONE_DBNAME'*' -print; #display old backups (if any) /usr/bin/find ${BACKUP_PATH} -mtime +$NUMBER_OF_DAILY_BACKUPS_TO_KEEP -name $ONE_DBNAME'*' -exec rm '{}' ';' #delete old backups (if any)
done


I'm at a loss to see why I'm getting this error for only one database when the exact same logic is applied for each of my databases and works fine for all the others.

I've tried doing the backup manually from the command line and found that I got the same error when I tried to backup the Maximal database that way; a manual backup of another database worked fine.

The only idea I have that seems vaguely plausible is that there is something internally wrong with my database but I'm darned if I know what the problem could be. When I do 'select *' against each of the five small tables in this database, each returns exactly the right data and there are no errors or warnings of any kind.

Can anyone suggest queries or commands that would reveal the status of my database and its tables to make sure something is not messed up?

Any suggestions on resolving this problem would be greatly appreciated.

---
Rhino





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

Reply via email to