A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.5 KiB

MySQL

Summary: Work with MySQL (and Maria) databases.

Common Options

  • admin_pass: The password off the admin-authorized user.
  • admin_user: The user name of the admin-authorized user. Default: root
  • host: The host name. Default: localhost
  • port: The TCP port. Default: 3306

Available Commands

mysql.create

Create a database. Argument is the database name.

  • owner: The user name that owns the database.
[create the database]
mysql.create: database_name

mysql.drop

Drop a database. Argument is the database name.

mysql.dump

Dump the database schema. Argument is the database name.

  • path: The path to the dump file. Default: database_name.sql
[create a soft backup of the database]
mysql.dump: example_app
path: /tmp/example_app.sql

mysql.exists

Determine if a database exists. Argument is the database name.

[determine if the database exists]
mysql.exists: example_app

mysql.grant

Grant privileges to a user.

  • database: The database name where privileges are granted.
  • privileges: The privileges to be granted. Default: ALL
[grant select privileges to bob]
mysql.grant: bob
privileges: select

mysql.user

Create a user. Argument is the username.

  • password: The user's password.
[create a database user]
mysql.user: username

Remove a user.

[create a database user]
mysql.user: username
op: remove

Determine if a user exists.

[create a database user]
mysql.user: username
op: exists