Skip to content

Instantly share code, notes, and snippets.

@xtfer
Last active January 30, 2019 22:19
Show Gist options
  • Save xtfer/6127781 to your computer and use it in GitHub Desktop.
Save xtfer/6127781 to your computer and use it in GitHub Desktop.
Sanitize a Drupal 7 database adapted from http://drupalscout.com/knowledge-base/creating-sanitized-drupal-database-backup This sets all passwords to "password". I run this using Sequel Pro, which will continue to run when errors occur, as it treats each line as a separate transaction.
UPDATE users SET mail = CONCAT(name, '@localhost'), init = CONCAT(name, '@localhost'), pass = '$S$Cd059Vsxc8berFeg6hspaa7ejx2bSxyUisvCbT4h9o8XIgSUtPKz';
UPDATE comment SET mail = CONCAT(name, '@localhost');
UPDATE authmap SET authname = CONCAT(aid, '@localhost');
UPDATE webform_submitted_data set data='scrubbed';
TRUNCATE accesslog;
TRUNCATE cache;
TRUNCATE cache_block;
TRUNCATE cache_bootstrap;
TRUNCATE cache_field;
TRUNCATE cache_form;
TRUNCATE cache_image;
TRUNCATE cache_filter;
TRUNCATE cache_menu;
TRUNCATE cache_metatag;
TRUNCATE cache_page;
TRUNCATE cache_rules;
TRUNCATE cache_token;
TRUNCATE cache_update;
TRUNCATE cache_views;
TRUNCATE cache_views_data;
TRUNCATE devel_queries;
TRUNCATE devel_times;
TRUNCATE flood;
TRUNCATE history;
TRUNCATE search_dataset;
TRUNCATE search_index;
TRUNCATE search_total;
TRUNCATE sessions;
TRUNCATE watchdog;
update variable set value = 's:4:"fake";' where name = 'smtp_password';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment