Skip to content

Instantly share code, notes, and snippets.

@jgraham909
Created March 29, 2013 19:02
Show Gist options
  • Save jgraham909/5272864 to your computer and use it in GitHub Desktop.
Save jgraham909/5272864 to your computer and use it in GitHub Desktop.
Drupal DB, settings.php and filesdir reset I use when developing install profiles that outside scope of drush. Warning this clobbers your db and files dir. USE AT YOUR OWN RISK
#!/bin/bash
# File used for Drupal development.
# WARNING: This deletes your drupal DB and files directory.
# This resets the database and sets up settings.php and files dir.
#
# Usage: `./reset`
# base dir no trailing slash (change these next 5 lines; the lower code shouldn't need adjustment.
BASEDIR=/var/www/html
DBUSER=drupal
DBNAME=drupal
DBPASS=drupal
WEBUSER=www-data
sudo cp ${BASEDIR}/sites/default/default.settings.php ${BASEDIR}/sites/default/settings.php
sudo rm -rf ${BASEDIR}/sites/default/files
sudo rm -rf ${BASEDIR}/sites/default/files
sudo mkdir ${BASEDIR}/sites/default/files
sudo chown -R ${WEBUSER}:${WEBUSER} ${BASEDIR}/sites/default/settings.php ${BASEDIR}/sites/default/files/
echo "DROP DATABASE IF EXISTS ${DBNAME}; CREATE DATABASE ${DBNAME} CHARACTER SET utf8 COLLATE utf8_general_ci" | mysql -u${DBUSER} -p${DBPASS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment