MysqlRocket is a Simple CLI tool to create and delete easily MySQL databases.
usage: mysqlrocket [-h] [-v] [-u U] [-H H] [-p P] {bk,dp,mk,ls,rm,st} ...
mysqlrocket commands are:
- bk Backup all databases on MySQL server
- dp Dump and gzip a MySQL database
- mk Create a MySQL database with an dedicated user and a random password
- ls Show databases on MySQL server
- rm Delete a MySQL database
- fs Flush a MySQL database
- cp Copy a MySQL database to another
- ld Import a dump into a database
- st Check your mysqlrocket config and MySQL server connectivity
Optional arguments:
- -h, --help show this help message and exit
- -v, --version Show program version.
- -u U mysql user
- -H H mysql host
- -p P mysql password
See 'mysqlrocket <command> -h' for more information on a specific command.
PyPI package https://pypi.org/project/mysqlrocket/
Sources https://github.com/cypx/mysqlrocket
Install it easily:
$ pip install mysqlrocket
Warning! On some old distribution using Python 2.x, you could require to upgrade pip to support install, run:
$ pip install --index-url=https://pypi.python.org/simple/ --upgrade pip setuptools
On most Linux distribution
$ easy_install mysqlrocket
But on some, prerequisites are required, for example, on Debian (6 to 8)
$ apt-get install python-pip python-mysqldb libmysqlclient-dev
(mysqldb could not be installed by easy_install cause of some system dependencies)
$ git clone https://github.com/cypx/mysqlrocket
$ cd mysqlrocket
$ python setup.py install
$ pip install mysqlrocket --upgrade
$ easy_install --upgrade mysqlrocket
$ pip uninstall mysqlrocket
Create a new database with an associated user account using the same name and a random password
$ mysqlrocket mk DATABASE_NAME
Create a new database with an associated user account using the same name and force password
$ mysqlrocket mk DATABASE_NAME -f DATABASE_PASSWORD
Dump all databases available on your server to the current directory
$ mysqlrocket bk
Dump a databases to the current directory
$ mysqlrocket dp DATABASE_NAME
Show all databases available on your server
$ mysqlrocket ls
Show all databases available on your server and some information (tables number, size...)
$ mysqlrocket ls -a
Remove a database and all user account with the same name if they exist
$ mysqlrocket rm DATABASE_NAME
Copy a database to another (flush destination database if its exist, create if not)
$ mysqlrocket cp SOURCE_DATABASE_NAME DESTINATION_DATABASE_NAME
Load dump file to database (flush destination database if its exist, create if not)
$ mysqlrocket ld SOURCE_DATABASE_NAME FILE_PATH
Flush a database (all content will be deleted)
$ mysqlrocket fs DATABASE_NAME
Check your mysqlrocket config file and MySQL server connectivity
$ mysqlrocket st