Skip to content

Instantly share code, notes, and snippets.

@ryantm
ryantm / rename_db
Created Feb 8, 2017 — forked from simonrjones/rename_db
Shell script to rename a database, based on https://www.percona.com/blog/2013/12/24/renaming-database-schema-mysql/ - Please note you need to ensure you have access to MySQL via your ~/.my.cnf file
View rename_db
#!/bin/bash
# Copyright 2013 Percona LLC and/or its affiliates
# @see https://www.percona.com/blog/2013/12/24/renaming-database-schema-mysql/
set -e
if [ -z "$3" ]; then
echo "rename_db <server> <database> <new_database>"
exit 1
fi
db_exists=`mysql -h $1 -e "show databases like '$3'" -sss`
if [ -n "$db_exists" ]; then
View instructions
Installation steps (untested, sorry no CentOS machine)
install file at /etc/init.d/marmalade
change PATH TO NODE BINARY
change PATH TO MARMALADE
change user if desired
#add script to rc.d
sudo chkconfig --add marmalade