.. _mysql_db: mysql_db `````````````````````````````` .. versionadded:: 0.6 Add or remove MySQL databases from a remote host. .. raw:: html
parameter | required | default | choices | comments |
---|---|---|---|---|
state | no | present |
|
The database state |
name | yes | name of the database to add or remove | ||
encoding | no | Encoding mode | ||
collation | no | Collation mode | ||
login_user | no | The username used to authenticate with | ||
login_host | no | localhost | Host running the database | |
login_password | no | The password used to authenticate with |
Create a new database with name 'bobdata'
mysql_db db=bobdata state=present
Requires the MySQLdb Python package on the remote host. For Ubuntu, this is as easy as apt-get install python-mysqldb.
Both login_password
and login_username
are required when you are passing credentials. If none are present, the module will attempt to read the credentials from ~/.my.cnf
, and finally fall back to using the MySQL default login of 'root' with no password.