mysql posts

MySQL Temporary Tables

If you have ever needed a routine which rebuilt a large database table every night, you've probably run into the following situation:  while the table is being rebuilt, whatever scripts which read from it will be broken, and you risk users of your system (or site) seeing the data when its still only half-populated.

For those MySQL gurus out there, you're probably screaming "use transactions, jerk!"  But, if you are using a MyISAM table instead of InnoDB, that isn't an option.

So what to do?

Temporary tables to the rescue!

If you didn't know what this type of table is, it is a table created in memory, which MySQL will automatically kill when your connection ends.  For web sites, that means as soon as your script is finished running.

Daily MySQL Backup - Drupal 6 Module

Attached File(s): 

 This module allows you to create a daily MySQL backup of your entire drupal database. If you have more than one drupal installation (or any other applications) on your database, you can tell the module to only backup tables with a particular prefix (eg. "site2_"). To install, simply unpack to /sites/all/modules/daily_mysql_backup, then visit Administer->modules, and enable it. To configure it, go to Administer->Site Configuration->Daily Mysql Backup.

Automatically download your backups to your computer every night with my new program, psBackup.


  • Backups are compatible with mysqldump (can be restored by any mysql client, including phpMyAdmin, sqlYog, Navicat, etc).
  • Keep backups for up to 30 days. Automatically deletes old ones after that.
  • You configure when to make a backup.
  • Backup files can be gzipped to make them as small as possible.
  • Random characters can be added to the backup filename to make it harder for hackers to guess your filenames.
  • Automatically excludes cache tables from backups.
  • You specify any additional tables to exclude.


Software License Fine Print

Creative Commons LicenseThis code is licensed as-is, with no warranty or guarantee, under a Creative Commons Attribution 3.0 Unported License.

You may use this code however you want, even in commercial products, but only if you include attribution to me, Richard Peacock, as the original author of this small portion of code, but not in a way that implies I endorse your project.

For example, on a Help/Credits screen:  Portions of this project were based on work freely obtained from these developers: Richard Peacock (, NAME HERE, etc.  These outside developers neither endorse nor support this software.

If you use this code, feel free to email me to let me know!  I'll include a link to your project here.

Syndicate content