fabtools.mysql

MySQL users and databases

This module provides tools for creating MySQL users and databases.

Manage users

fabtools.mysql.user_exists(name, host='localhost', **kwargs)[source]

Check if a MySQL user exists.

fabtools.mysql.create_user(name, password, host='localhost', **kwargs)[source]

Create a MySQL user.

Example:

import fabtools

# Create DB user if it does not exist
if not fabtools.mysql.user_exists('dbuser'):
    fabtools.mysql.create_user('dbuser', password='somerandomstring')

Manage databases

fabtools.mysql.database_exists(name, **kwargs)[source]

Check if a MySQL database exists.

fabtools.mysql.create_database(name, owner=None, owner_host='localhost', charset='utf8', collate='utf8_general_ci', **kwargs)[source]

Create a MySQL database.

Example:

import fabtools

# Create DB if it does not exist
if not fabtools.mysql.database_exists('myapp'):
    fabtools.mysql.create_database('myapp', owner='dbuser')
Read the Docs v: 0.17.0
Versions
latest
0.17.0
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.