Update to AutoMySQLBackup.sh

January 28, 2011

For a long time I though the AutoMySQLBackup project had died.  Then, after I created many updates, in November of last year I saw some life. Meanwhile, I have continued to update the code and track what people have requested.   Low volume project are sometimes hard to keep alive. People think the project is dead and don’t want to use code that will not see updates.  Then if you make updates the authors may not come alive often enough to make the changes.

I have updated AutoMySQLBackup again. This time I have included the ability to make backups at the table level by including the table name, with the database name, in the list of databases to be backed up.  Adding a ‘.’ between the database name and the table name (data.table) will backup only that table in the database.  (IE DBNAME=”mysql test database.table”)

You can download my version here.  automysqlbackup.sh.

Some of my improvements include:

  • copy (rsync) the local backup files to a remote locations using the COPYDIR variable.
  • option to copy files into a directory based on the host name using the variable HOSTNAME.  This allows the script to be run from a shared storage directory ( SBM, NFS, NetApp) the data to be kept separate.
  • option to backup the full schema only using variable FULLSCHEMA.
  • option to backup MySQL configuration file, my.cnf
  • remove files older then seven days from the BACKUPDIR directory.
  • Added –master-data=2 and –single-transaction to include a replication information as a comment
  • The ability to backup a single table in a database.

Tweet

posted in Commentary by mark

Follow comments via the RSS Feed | Leave a comment | Trackback URL

14 Comments to "Update to AutoMySQLBackup.sh"

  1. Sean wrote:

    I like your 404 and all, but a working download would be nice :)

  2. kedar wrote:

    Mark, the link to automysqlbackup.sh is broken.

  3. Raffael wrote:

    Hi Mark,

    I really like this software. I use it on several machines and I am mostly happy with it. On one machine I always get the following message:
    mysqldump: Got error: 1044: Access denied for user ‘root’@'localhost’ to database ‘information_schema’ when using LOCK TABLES

    I don’t know exactly why it is only on one machine. It could be because it is the newest MySQL version. Maybe you can write a fix for this in the next version.

    And another idea: It would be cool to have a complementary restore script, where not only a database would be restored but the corresponding users and grants as well. (I guess this is not that easy. I didn’t find an easy solution either. But maybe you have a good idea.) Often it doesn’t make sense to restore the full mysql table just because one database gets restored.

  4. mike wrote:

    I think the link is bad :)

  5. mark wrote:

    This link should be working. If you have trouble please email me mark @ grennan.com

    I have not tested my updates on MySQL 5.5. I’m currently using 5.1.

  6. Martin wrote:

    Mark, the link for automysqlbackup.sh you’ve posted doesn’t work :-(

  7. mark wrote:

    This link is working for me. Can you tell me the link you are using?

    http://www.mysqlfanboy.com/Files/automysqlbackup.sh

  8. Martin wrote:

    Hi,

    The link in your article points to…

    http://www.mysqlfanboy.com/2011/01/Files/automysqlbackup.sh

    Thanks for the new link :-)

  9. Eric H wrote:

    Hi Mark,
    I like the script a lot.

    I would like to request a feature.

    It would be nice to have mysqldump piped to gzip, so that it writes only compressed dumps to disk.

    This will avoid excessive disk thrashing as it dumps then has to gzip after the dump is written to disk.

    Thanks,
    -Eric

  10. Andy wrote:

    I would really like to use this but I am getting the following error on a Ubuntu 8.0.4 LTS box:

    line 466: {split($0,a,”.”) ; print a[1] }: command not found

  11. Kelly grennan wrote:

    Who was your great grandfather and your grandfather on the grennan side. All of our family is from ireland to squim washington then on from there. Fintan joesph grennan, fenton joesph grennan, george alden grennan, john “kelly” grennan ( me born in 1948 auburn washington, william lee grennan, dylan zane grennan Have never met another grennan that i wasnt related too. My great grandfather fintan joesph came from thomastown ireland. 12 children, his son my grandfather fenton joesph grennan born in squim washington one of 13, my father george alden grennan born in algonqin washington one of 13, myself oldest of nine born in auburn washington raised in enumclaw washington.

  12. mark wrote:

    I don’t know much of ancestry. I know my grandfather was Gilbert Grennan. My wife knows more than me. She is the genealogist in our family. You can write her at .

  13. Pascall wrote:

    Hi,
    I tried to use your script but i had the same error as Andy, and MORE!!
    It remove everything in my /var/log et /var/www and some other folders!!!!

    i gonna look at the script line after line to see if it’s a mistake or if you do it intentionally…

    be careful if you use it !

  14. mark wrote:

    I reviewed the code. I didn’t see any way the script would delete the files you said unless you pointed your backups to be put in these directory?

    Not smart if you did. The documentation says “… remove files older then seven …
    days from the BACKUPDIR directory.”

Leave Your Comment

 



Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org
Creative Commons License
MySQL Fan Boy by Mark Grennan is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
HOME