mySql

Automated Drupal database backups using Drush, Bash and Cron

Drush + Bash + Cron: Datbase Backup Goals

  • Scan sites directory for a given drupal install
  • Find all multisite folders/symlinks
  • For each multisite:
  • Use Drush to clear cache - we dont want cache table bloating up the MySQL dump file
  • Use Drush to delete watchdog logs - we dont want watchdog table bloating up the MySQL dump file
  • Use Drush to backup the database to pre-assigned folder
  • Use tar to compress and timestamp the Drush generated sql file

Drupal MySQL to CSV export - easy way

Today I attempted to export MySQL data from Drupal into a CSV file, easy enough, I thought to myself...

After battling for hours trying to do the pesky character escapes and string manipulation, I came across some very handy code in the Views Bonus Pack CSV Export module.

If you are using the views module, this addon is very handy indeed and will save you many hours of manual labour..

Here is a slightly modified version that can be used in any custom module (for instance when you are not using the excellent Views module)

Monitoring MySQL queries using PROCESSLIST

Trying to debug the sluggishness of this website, I came across this is really handy tip from Khalid @ 2bits.com:

Syndicate content