Create, read, and update a Linode MySQL database.
Field |
Type |
Required |
Description |
api_token |
str |
Required |
The Linode account personal access token. It is necessary to run the module. It can be exposed by the environment variable LINODE_API_TOKEN instead. See details in Usage. |
- name: Create a basic MySQL database
linode.cloud.database_mysql_v2:
label: my-db
region: us-mia
engine: mysql/8
type: g6-nanode-1
allow_list:
- 0.0.0.0/0
state: present
- name: Create a MySQL database with three nodes
linode.cloud.database_mysql_v2:
label: my-db
region: us-mia
engine: mysql/8
type: g6-standard-1
cluster_size: 3
allow_list:
- 0.0.0.0/0
state: present
- name: Create a MySQL database with an explicit maintenance schedule
linode.cloud.database_mysql_v2:
label: my-db
region: us-mia
engine: mysql/8
type: g6-nanode-1
updates:
duration: 4
frequency: weekly
hour_of_day: 16
day_of_week: 4
state: present
- name: Create a MySQL database forked from another database
linode.cloud.database_mysql_v2:
label: my-db
region: us-mia
engine: mysql/8
type: g6-nanode-1
fork:
source: 12345
state: present
- name: Delete a MySQL database
linode.cloud.database_mysql_v2:
label: my-db
state: absent
Field |
Type |
Required |
Description |
state |
str |
Required |
The desired state of the Managed Database. (Choices: present , absent ) |
allow_list |
list |
Optional |
A list of IP addresses and CIDR ranges that can access the Managed Database. (Updatable) |
cluster_size |
int |
Optional |
The number of Linode instance nodes deployed to the Managed Database. (Updatable) |
engine |
str |
Optional |
The Managed Database engine in engine/version format. (Updatable) |
label |
str |
Optional |
The label of the Managed Database. |
region |
str |
Optional |
The region of the Managed Database. |
type |
str |
Optional |
The Linode Instance type used by the Managed Database for its nodes. (Updatable) |
fork (sub-options) |
dict |
Optional |
Information about a database to fork from. |
updates (sub-options) |
dict |
Optional |
Configuration settings for automated patch update maintenance for the Managed Database. (Updatable) |
wait_timeout |
int |
Optional |
The maximum number of seconds a poll operation can take before raising an error. (Default: 2700 ) |
Field |
Type |
Required |
Description |
restore_time |
str |
Optional |
The database timestamp from which it was restored. |
source |
int |
Optional |
The instance id of the database that was forked from. |
Field |
Type |
Required |
Description |
day_of_week |
int |
Required |
The day to perform maintenance. 1=Monday, 2=Tuesday, etc. (Choices: 1 , 2 , 3 , 4 , 5 , 6 , 7 ) |
duration |
int |
Required |
The maximum maintenance window time in hours. |
hour_of_day |
int |
Required |
The hour to begin maintenance based in UTC time. |
frequency |
str |
Optional |
The frequency at which maintenance occurs. (Choices: weekly ; Default: weekly ) |
-
database
- The database in JSON serialized form.
- Sample Response:
{
"allow_list": [
"10.0.0.3/32"
],
"cluster_size": 3,
"created": "2025-02-10T20:10:20",
"encrypted": true,
"engine": "mysql",
"hosts": {
"primary": "a225891-akamai-prod-1798333-default.g2a.akamaidb.net",
"standby": "replica-a225891-akamai-prod-1798333-default.g2a.akamaidb.net"
},
"id": 12345,
"label": "my-db",
"members": {
"172.104.207.136": "primary",
"194.195.112.177": "failover",
"45.79.126.72": "failover"
},
"oldest_restore_time": "2025-02-10T20:15:07",
"platform": "rdbms-default",
"port": 11876,
"region": "ap-west",
"ssl_connection": true,
"status": "active",
"total_disk_size_gb": 30,
"type": "g6-standard-1",
"updated": "2025-02-10T20:25:55",
"updates": {
"day_of_week": 4,
"duration": 4,
"frequency": "weekly",
"hour_of_day": 16,
"pending": []
},
"used_disk_size_gb": 0,
"version": "8.0.35"
}
- See the Linode API response documentation for a list of returned fields
-
ssl_cert
- The SSL CA certificate for an accessible Managed MySQL Database.
-
credentials
- The root username and password for an accessible Managed MySQL Database.