-
Notifications
You must be signed in to change notification settings - Fork 1
Simple python script for 'renaming' a DB by issuing RENAME TABLE statements
License
cclark/Rename-MySQL-DB
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Summary ----------- A simple script to provide rename/mv like functionality for MySQL databases. This script was written in response to not receiving any desirable answers to a question about easily switching between two databases in MySQL to minimize downtime when refreshing databases in an actively used environment. http://serverfault.com/questions/126509/how-to-proxy-to-different-named-databases-on-the-same-server-using-mysql-proxy and a similar question about renaming MySQL databases: http://stackoverflow.com/questions/67093/how-do-i-quickly-rename-a-mysql-database-change-schema-name RENAME DATABASE functionality existed natively within MySQL at one point in time but was removed when it was found to be unreliable. http://dev.mysql.com/doc/refman/5.1/en/rename-database.html Author: Chuck Clark <[email protected]> Version: 0.1 Date: 2010-04-19 Requirements ------------ - Python 2.7 & Python 3+ - MySQLdb (http://sourceforge.net/projects/mysql-python/) Usage ----- ```bash $ python rename_db.py --help Usage: rename_db.py [options] <olddb> <newdb> Script to 'rename' a MySQL database by moving all tables from one database to another. Options: --version show program's version number and exit -h, --help show this help message and exit --host=HOST Host address of mysql server -p PASSWORD, --password=PASSWORD Password for mysql user -u USER, --user=USER User name for mysql -v, --verbose Be verbose and show debugging level output -q, --quiet Be quiet. Show no output unless an error occurs --drop-triggers Drop triggers instead of listing triggers preventing the renames from occurring --create-database Create the destination database if it doesn't exist $ python rename_db.py --host test-db.us-west-2.rds.amazonaws.com -u root -p password --create-database test test_v1 ``` License ------- Released under the MIT License. Feedback -------- Send patches, issues and comments to [email protected].
About
Simple python script for 'renaming' a DB by issuing RENAME TABLE statements
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published