Skip to content

Instantly share code, notes, and snippets.

@Wieljer
Wieljer / enable_drupal-module_mysql.sh
Created August 15, 2016 19:40
Simple bash file to turn on/off drupal modules via mysql
#!/bin/bash
# Sets the status to 0 or 1 which turns that module on or off.
# To list the modules you can "USE drupal;" then run "SELECT name,status FROM system WHERE type='module';"
ROOT_USER="root"
ROOT_PASS=$(</mysql_password/user.txt)
echo "$ROOT_PASS"
mysql -u "$ROOT_USER" -p"$ROOT_PASS" <<MYSQL_SCRIPT
USE drupal;
UPDATE system SET status='0' WHERE name='some_drupal_module';
@Wieljer
Wieljer / setup_drupal.bash
Created July 5, 2016 20:50
Non-interactive bash script to create mysql db, user with generated password and import a drupal website using drush.
##################################################
# Note: Line 70 will remove the html dir
# because we install a backup site.
##################################################
##################################################
# Setup mysql
###################################################
#!/bin/bash
@Wieljer
Wieljer / create-mysql.bash
Last active September 4, 2022 00:07 — forked from omeinusch/create-mysql.bash
Simple non-interactive bash script to create mysql db, user with generated password.
#!/bin/bash
PASS=$(pwgen -s 15 1)
USER="CDRT"
DB="drupal"
service mysqld start
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $DB;
CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASS';