Problem with Mysqldump

Discussion in 'Server / Technical Administration Tips and Queries' started by grandad, Mar 9, 2013.

  1. grandad

    grandad Moderator

    I have a few Wordpress installations running and want to create a simple, reliable way of backing up the databases. For various reasons I have decided against plugins, and am using Cron.

    I created a script which is called from Cron -
    /usr/bin/mysqldump --host=hostserver --user=username --password=password database --quick > /usr/local/webspace/httpdocs/backups/backupdb-`date +%d.%m.%y`.sql
    My problem is that this script works perfectly on two of the sites, but on the third it just produces an empty file.

    The database sizes are 13.8 Mb, 3.4 Mb and 31.4 Mb, and it is the last one that is failing.

    Has anyone got any ideas as to why one should fail when the other two work? Could the size be relevant?
  2. mneylon

    mneylon Administrator Staff Member

    Size shouldn't be an issue.. it would be helpful if you had some errors to work with :)
  3. grandad

    grandad Moderator

    Not having terminal access to the server, I can't run the command directly. Forgive my ignorance but is there a way to dump errors etc to a file?

    Problem Solved!

    Through a lot of trial and error, found the problem - mysqldump didn't like some of the characters used in the database password. Set up a new user for the DB and the job is oxo. :eagerness:
  4. mneylon

    mneylon Administrator Staff Member

    Ah - makes sense.. if the characters were a bit "odd" you might have had to escape them ..
  5. grandad

    grandad Moderator

    I tried that but the code bitched about the escape characters! I ended up creating a new database user with a password containing non-contentious characters. :congratulatory:
  6. mneylon

    mneylon Administrator Staff Member

    I've always had problems with escaping characters - invariably I get it wrong ..

Share This Page