Skip to main content

mysql_instances

Creates, updates, deletes, gets or lists a mysql_instances resource.

Overview

Namemysql_instances
TypeResource
Idlinode.databases.mysql_instances

Fields

The following fields are returned by SELECT queries:

Returns information for a single MySQL Managed Database.

NameDatatypeDescription
idintegerRead-only A unique ID that can be used to identify and reference the Managed Database.
allow_listarrayControls access to the Managed Database. - Individually included IP addresses or CIDR ranges can access the Managed Database while all other sources are blocked. - A standalone value of 0.0.0.0/0 allows all IP addresses access to the Managed Database. - An empty array ([]) blocks all public and private connections to the Managed Database.
cluster_sizeintegerThe number of Linode instance nodes deployed to the Managed Database. - Choose 3 nodes to create a high availability cluster that consists of one primary node and two replica nodes. - A 2 node cluster is only available with a dedicated plan. It consists of one primary node and one replica node.
createdstring (date-time)Read-only When this Managed Database was created. (example: 2022-01-01T00:01:01)
encryptedbooleanRead-only Whether the Managed Databases is encrypted. Currently required to be true.
enginestringFilterable, Read-only The Managed Database engine type. (example: mysql)
engine_configobjectAdvanced parameters you can apply to a MySQL Managed Database, via our partner Aiven's specification. Only include the objects for parameters you want to set in your database. Omit objects for parameters you don't want to define or change. > 📘 > > Aiven may offer additional parameters in their specification. Currently, only those listed here are supported for use in a MySQL Managed Database. You can also run the List MySQL Managed Database advanced parameters operation to see an up-to-date list.
forkobjectDetails on the database that was the target of the fork. This only exists if the database was restored by creating a fork from another MySQL or PostgreSQL database.
hostsobjectRead-only The primary and secondary hosts for the Managed Database. These are assigned after provisioning is complete.
labelstringFilterable A unique, user-defined string referring to the Managed Database. This string needs to be unique per Managed Database engine type. (example: example-db)
membersobjectRead-only A mapping between IP addresses and strings designating them as primary or failover.
oldest_restore_timestring (date-time)Read-only The oldest time to which a database can be restored. (example: 2024-10-03 20:48:05)
platformstringFilterable, Read-only The back-end platform for relational databases used by the service. (example: rdbms-default)
portintegerRead-only The access port for this Managed Database.
regionstringFilterable The Region ID for the Managed Database. (example: us-east)
ssl_connectionbooleanCurrently required to be true. Whether to require SSL credentials to establish a connection to the Managed Database. Run the Get managed MySQL database credentials operation for access information.
statusstringFilterable, Read-only The operating status of the Managed Database. (example: active)
total_disk_size_gbintegerRead-only The total disk size of the database, in GB.
typestringFilterable The Linode Instance type used by the Managed Database for its nodes. (example: g6-dedicated-2)
updatedstring (date-time)Read-only When this Managed Database was last updated. (example: 2022-01-01T00:01:01)
updatesobjectConfiguration settings for automated patch update maintenance for the Managed Database.
used_disk_size_gbintegerRead-only The amount of space currently in use in the database, in GB.
versionstringFilterable The Managed Database engine version. (example: 8.0.26)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_databases_mysql_instanceselectDisplay information for a single, accessible MySQL Managed Database.

Learn more...

Learn more...
get_databases_mysql_instancesselectpage, page_sizeDisplay all accessible MySQL Managed Databases.

Learn more...

Learn more...
post_databases_mysql_instancesinsertdata__label, data__type, data__engine, data__regionProvision a MySQL Managed Database

Use this operation to create a new MySQL Managed Database.

- Restricted users need the add_databases user grant.

- New instances can take 10 to 15 minutes to deploy.

- When you create a new MySQL Managed Database, our partner Aiven automatically enables disk encryption on each cluster.

- All Managed Databases include automatic, daily backups. Up to seven backups are automatically stored for each Managed Database, providing restore points for each day of the past week.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the MySQL Managed Database. Configure the maintenance window for these updates with the Update a managed MySQL database operation.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. You should adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_create event.

Restore a MySQL Managed Database

Include the fork object in the request to target a backed-up database. Your user needs read_write access to the target database and its status can be active, degraded, or failed.

> 📘
>
> Restoring from a backup creates a second running cluster, which incurs billing. Delete the first cluster after the restore is complete, to avoid this billing. CLI for create operation.

<br /> linode-cli databases mysql-create \<br /> --label example-db1 \<br /> --region us-east \<br /> --type g6-dedicated-2 \<br /> --cluster_size 3 \<br /> --engine mysql/8.0.26 \<br /> --engine_config.binlog_retention_period 60 \<br /> --engine_config.mysql.connect_timeout 10 \<br /> --engine_config.mysql.default_time_zone +03:00 \<br /> --ssl_connection true \<br /> --allow_list 203.0.113.1 \<br /> --allow_list 192.0.1.0/24<br />

Learn more...

Learn more...
post_databases_mysql_instance_patchupdateApply security patches and updates to the underlying operating system of the MySQL Managed Database. This function runs during regular maintenance windows, which you can configure with the Update a managed MySQL database operation.

- The user needs read_write user grant access to the database.

- The database's status meeds to be active.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_upgrade event.

Learn more...

Learn more...
put_databases_mysql_instancereplaceMake changes to an existing MySQL Managed Database.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- New values set in the allow_list overwrite existing values. To keep existing values, run the List MySQL Managed Databases operation, store the allow_list addresses from the response, and include them with any new addresses in this operation.

- Updates to your allow_list may take a short time to complete, making this operation inappropriate for rapid successive updates.

- Also allows resizing the database cluster to a larger one. Clusters can't be resized to smaller plans.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the Managed MySQL Database. Use the updates object in this operation to modify the maintenance window for these updates.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Use the updates object to adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- You can't update engine_config advanced parameter settings for a suspended database. You'll need to resume it first.

- A successful request triggers a database_update event.

Learn more...

Learn more...
delete_databases_mysql_instancedeleteRemove a MySQL Managed Database from your account.

- The user needs read_write user grant access to the database.

- The database's status can be active, failed, or degraded.

- Only unrestricted users can access this operation. They have access regardless of the acting token's OAuth scopes.

Learn more...

Learn more...
resume_databases_mysql_instanceexecResume a suspended MySQL Managed Database from your account. This resumes billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be suspended.

- A successful request triggers a database_resume event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...
suspend_databases_mysql_instanceexecSuspend a MySQL Managed Database from your account, releasing idle resources and keeping only necessary data. All service data is lost if there are no backups available. This halts billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- Akamai deletes suspended clusters after 180 days.

- A successful request triggers a database_update event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
pageintegerThe page of a collection to return.
page_sizeintegerThe number of items to return per page.

SELECT examples

Display information for a single, accessible MySQL Managed Database.

Learn more...

Learn more...

SELECT
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
oldest_restore_time,
platform,
port,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version
FROM linode.databases.mysql_instances;

INSERT examples

Provision a MySQL Managed Database

Use this operation to create a new MySQL Managed Database.

- Restricted users need the add_databases user grant.

- New instances can take 10 to 15 minutes to deploy.

- When you create a new MySQL Managed Database, our partner Aiven automatically enables disk encryption on each cluster.

- All Managed Databases include automatic, daily backups. Up to seven backups are automatically stored for each Managed Database, providing restore points for each day of the past week.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the MySQL Managed Database. Configure the maintenance window for these updates with the Update a managed MySQL database operation.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. You should adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_create event.

Restore a MySQL Managed Database

Include the fork object in the request to target a backed-up database. Your user needs read_write access to the target database and its status can be active, degraded, or failed.

> 📘
>
> Restoring from a backup creates a second running cluster, which incurs billing. Delete the first cluster after the restore is complete, to avoid this billing. CLI for create operation.

<br /> linode-cli databases mysql-create \<br /> --label example-db1 \<br /> --region us-east \<br /> --type g6-dedicated-2 \<br /> --cluster_size 3 \<br /> --engine mysql/8.0.26 \<br /> --engine_config.binlog_retention_period 60 \<br /> --engine_config.mysql.connect_timeout 10 \<br /> --engine_config.mysql.default_time_zone +03:00 \<br /> --ssl_connection true \<br /> --allow_list 203.0.113.1 \<br /> --allow_list 192.0.1.0/24<br />

Learn more...

Learn more...

INSERT INTO linode.databases.mysql_instances (
data__allow_list,
data__cluster_size,
data__engine,
data__engine_config,
data__fork,
data__label,
data__region,
data__ssl_connection,
data__type
)
SELECT
'{{ allow_list }}',
{{ cluster_size }},
'{{ engine }}' --required,
'{{ engine_config }}',
'{{ fork }}',
'{{ label }}' --required,
'{{ region }}' --required,
{{ ssl_connection }},
'{{ type }}' --required
RETURNING
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
oldest_restore_time,
platform,
port,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version
;

UPDATE examples

Apply security patches and updates to the underlying operating system of the MySQL Managed Database. This function runs during regular maintenance windows, which you can configure with the Update a managed MySQL database operation.

- The user needs read_write user grant access to the database.

- The database's status meeds to be active.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_upgrade event.

Learn more...

Learn more...

UPDATE linode.databases.mysql_instances
SET
-- No updatable properties
WHERE
;

REPLACE examples

Make changes to an existing MySQL Managed Database.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- New values set in the allow_list overwrite existing values. To keep existing values, run the List MySQL Managed Databases operation, store the allow_list addresses from the response, and include them with any new addresses in this operation.

- Updates to your allow_list may take a short time to complete, making this operation inappropriate for rapid successive updates.

- Also allows resizing the database cluster to a larger one. Clusters can't be resized to smaller plans.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the Managed MySQL Database. Use the updates object in this operation to modify the maintenance window for these updates.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Use the updates object to adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- You can't update engine_config advanced parameter settings for a suspended database. You'll need to resume it first.

- A successful request triggers a database_update event.

Learn more...

Learn more...

REPLACE linode.databases.mysql_instances
SET
data__allow_list = '{{ allow_list }}',
data__engine_config = '{{ engine_config }}',
data__label = '{{ label }}',
data__type = '{{ type }}',
data__updates = '{{ updates }}',
data__version = '{{ version }}'
WHERE

RETURNING
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
oldest_restore_time,
platform,
port,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version;

DELETE examples

Remove a MySQL Managed Database from your account.

- The user needs read_write user grant access to the database.

- The database's status can be active, failed, or degraded.

- Only unrestricted users can access this operation. They have access regardless of the acting token's OAuth scopes.

Learn more...

Learn more...

DELETE FROM linode.databases.mysql_instances;

Lifecycle Methods

Resume a suspended MySQL Managed Database from your account. This resumes billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be suspended.

- A successful request triggers a database_resume event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...

EXEC linode.databases.mysql_instances.resume_databases_mysql_instance 
;