Managed Database for PostgreSQL and MySQL provides fully-managed relational Database Instances, with MySQL or PostgreSQL as database engines. The resource allows you to focus on development rather than administration or configuration. It comes with a high-availability mode, data replication, and automatic backups.
Compared to traditional database management, which requires customers to provide their infrastructure and resources to manage their databases, Managed Database for PostgreSQL and MySQL Instance offers the user access to Database Instances without setting up the hardware or configuring the software. Scaleway handles the provisioning, manages the configuration, and provides useful features as high availability, automated backup, user management, and more.
Concepts
Refer to our dedicated concepts pageOpen in new context to find definitions of the different terms referring to Managed Database for PostgreSQL and MySQL.
Quickstart
-
Configure your environment variables.
Note
This is an optional step that seeks to simplify your usage of the APIs.
Code -
Edit the POST request payload you will use to create your Database Instance. Replace the parameters in the following example:
CodeParameter Description project_idThe ID of the Project you want to create your Database Instance in. To find your Project ID you can list the projects or consult the Scaleway consoleOpen in new context. engineREQUIRED Version ID of the database engine. To check the list of available engines you can use the following endpoint: https://api.scaleway.com/rdb/v1/regions/$SCW_REGION/database-enginesnameName of the Database Instance node_typeREQUIRED The node type. To check the list of available node types you can use the following endpoint: https://api.scaleway.com/rdb/v1/regions/$SCW_REGION/node-typesis_ha_clusterBOOLEAN Defines whether High Availability is enabled for the Database Instance disable_backupBOOLEAN Defines whether automated backups are disabled for the Database Instance tagsThe list of tags ["tag1", "tag2", ...]that will be associated with the Database Instance. Tags can be appended to the query of the List Database Instances call to show results for only the Database Instances using a specific tag. You can also combine tags to list Database Instances that possess all the appended tags.user_nameREQUIRED Identifier of the default user, which is created concurrently with the Database Instance passwordREQUIRED Password for the default user volume_typeType of volume where data is stored. You can specify either local volume ( lssd) or block volume (bssd,sbs_5korsbs_15k). The default value islssdvolume_sizeVolume size when volume_type is bssd,sbs_5korsbs_15k. The value should be expressed in bytes. For example 30GB is expressed as 30000000000 -
Create a Database Instance by running the following command. Make sure you include the payload you edited in the previous step.
Code -
List your Database Instances.
CodeYou should get a response like the following:
Note
This is a response example, the UUIDs and IP address displayed are not real.
Code -
Retrieve your Database Instance IP and port from the response.
Note
In the example above, the IP and port are and , respectively.
-
Connect to your Database Instance with the database client of the engine you selected. For MySQL, run the following command:
CodeFor PostgreSQL, run:
CodeFor the recurring example, the command would look like:
Code -
Enter the database password that you defined upon creation.
You are now connected to your Managed Database.
Requirement
To perform the following steps, you must first ensure that:
- you have an account and are logged into the Scaleway consoleOpen in new context
- you have created an API keyOpen in new context and that the API key has sufficient IAM permissionsOpen in new context to perform the actions described on this page.
- you have installed
curlOpen in new context
Technical Information
Regions
Scaleway's infrastructure is spread across different regions and Availability ZonesOpen in new context.
Managed Database for PostgreSQL and MySQL is available in the Paris, Amsterdam and Warsaw regions, which are represented by the following path parameters:
fr-parnl-amspl-waw
PostgreSQL specifications
Versions
Scaleway Database for PostgreSQL supports PostgreSQL versions 11, 12, 13, 14 and 15.
System
Different modules are available for installation, including TimescaleDB and PostGIS. Refer to the Managed Database for PostgreSQL and MySQL FAQ pageOpen in new context for an extensive list of PostgreSQL extensions.
Database Management
You can create logical databases through the Scaleway console, the Scaleway APIs or SQL.
- databases created using the Scaleway console or the API are owned by an internal system user. These are called "managed databases".
- databases created using SQL will be owned by the creator. These are called "unmanaged databases".
MySQL specifications
Versions
Scaleway Database for MySQL supports MySQL 8.
System
- only the InnoDB engineOpen in new context is supported
- the Global Transaction Identifier (GTID)Open in new context is enabled.
mysql_native_passwordOpen in new context (default) andcaching_sha2_passwordOpen in new context authentication are supported.
User Management
- users with an
adminrole have access to all logical databases and can create new ones. - users created via the API are authenticated using the default authentication plugin, which can be changed in the settings.
Technical Limitations
PostgreSQL
User Management
- users with an
adminrole haveCREATEROLEandCREATEDBprivileges. - users do NOT have
SUPERUSERnorREPLICATIONprivileges. - permission management through the Scaleway console or API is only possible for the "managed databases".
Backup and restoration
Databases that have been backed up and then restored retain the user permission settings in use at the time of backup. If you delete users after backup and then restore your backup in the same database, or if you restore a backup to a different database with different or no users, the permissions configured for them continue to exist, but with no associated owner. This error will put a stop to the restoration process.
To avoid this issue, we recommend you re-create the users you deleted. In the occasion you restore the backup to a new database, you must create new users with the same names.
Going Further
For more information about Managed Database for PostgreSQL and MySQL, you can check out the following pages:
- Managed Database for PostgreSQL and MySQL DocumentationOpen in new context
- Managed Database for PostgreSQL and MySQL FAQOpen in new context
- Scaleway Slack CommunityOpen in new context join the #database channel
- Contact our support teamOpen in new context
How to migrate a database
If you wish to migrate existing databases to a Managed Database for PostgreSQL or MySQL, you can refer to the Migrating existing databases to a Database InstanceOpen in new context tutorial page.
Troubleshoooting
Disk full status
If your Database Instance uses local storage, your local volume might eventually approach full capacity and shift to disk_full mode. This mode grants you enough space to either upgrade your node typeOpen in new context or clear out space in your volumeOpen in new context.
Loadbalancer endpoints are not available on Read Replicas even if this resource is displayed in the Read Replica response example.
If you want to remove a Read Replica endpoint, you can use delete a Database Instance endpoint API call.
Instance Access Control Lists (ACL) also apply to Read Replica direct access endpoints.
Limitations:
There might be replication lags between the primary node and its Read Replica nodes. You can try to reduce this lag with some good practices:
- All your tables should have a primary key
- Don't run large transactions that modify, delete or insert lots of rows. Try to split it into several small transactions.
- None: No access to the database
- Read: Allow users to read tables and fields in a database
- Write: Allow users to write content in databases.
- Admin: Read and write access to the data, and extended privileges depending on the database engine.
admin role can create new databases and users.- General Purpose: production-grade nodes designed for scalable database infrastructures.
- Development: sandbox environments and reliable performance for development and testing purposes.