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.

89 lines
1.5 KiB

3 years ago
# 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.
```ini
[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.
2 years ago
- `path`: The path to the dump file. Default: `database_name.sql`
3 years ago
2 years ago
```ini
[create a soft backup of the database]
mysql.dump: example_app
path: /tmp/example_app.sql
```
3 years ago
### mysql.exists
Determine if a database exists. Argument is the database name.
2 years ago
```ini
[determine if the database exists]
mysql.exists: example_app
```
3 years ago
### mysql.grant
2 years ago
Grant privileges to a user.
3 years ago
- `database`: The database name where privileges are granted.
2 years ago
- `privileges`: The privileges to be granted. Default: `ALL`
```ini
[grant select privileges to bob]
mysql.grant: bob
privileges: select
```
3 years ago
2 years ago
### mysql.user
3 years ago
2 years ago
Create a user. Argument is the username.
3 years ago
- `password`: The user's password.
2 years ago
```ini
[create a database user]
mysql.user: username
```
3 years ago
2 years ago
Remove a user.
3 years ago
2 years ago
```ini
[create a database user]
mysql.user: username
op: remove
```
3 years ago
2 years ago
Determine if a user exists.
```ini
[create a database user]
mysql.user: username
op: exists
```