SQL backup error

Discussion in 'General' started by mphayesuk, Feb 27, 2008.

  1. mphayesuk

    mphayesuk Member HowtoForge Supporter

    Hi all when I run the following command in my backup script I get the error shown below and the size of the tar file from the sql tables is 0kb.

    for i in $(echo 'SHOW DATABASES;' | mysql -u$USER -p$PASSWORD -h$HOST|grep -v 'Databases$'); do mysqldump \
    -u$USER -p$PASSWORD -h$HOST \ -Q -c -C --add-drop-table --add-locks --quick --lock-tables \ $i > /tmp/systembackups/$Today/mysql_backup/$i.sql;
    done;

    ** Error **

    mysqldump: Got error: 1049: Unknown database ' -Q' when selecting the database
    mysqldump: Got error: 1049: Unknown database ' -Q' when selecting the database
    mysqldump: Got error: 1049: Unknown database ' -Q' when selecting the database
    mysqldump: Got error: 1049: Unknown database ' -Q' when selecting the database

    Can anyone see why this is.

    Thanks
    Martin
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What happens when you leave out the -Q switch?
     
  3. mphayesuk

    mphayesuk Member HowtoForge Supporter

    removed the -Q and now the same error has happened but with -c instead....

    Thanks
    Martin
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess that you have problems with the linebreaks. make a zip file out of your shell script and attach it to this thread. make sure that you change / remove passwords in the script before you post it.
     
  5. mphayesuk

    mphayesuk Member HowtoForge Supporter

    Ok I have fixed the error.... I am running a couple of versions behind with about 20 customers on this server and there are no customer sql databases stored. My backup which was tared and ziped has come to 134K does that sound about right.

    Thanks
    Martin
     

Share This Page