Sidebar navigationMain contentFooter
Jump toContribute on Github

How to connect to a Serverless SQL Database

Reviewed on 19 February 2024Published on 11 August 2023

This page shows you how to set up the connection to a Serverless SQL Database using the Scaleway console.

Security & Identity (IAM)

To perform certain actions described below, you must either be the Owner of the Organization in which the actions will be performed, or an IAM user with the necessary permissions.

  • You have an account and are logged into the Scaleway console
  • You have created a Serverless SQL Database

How to set up credentials

  1. From the Overview tab of your database, click the Set up credentials button. The setup wizard displays.

  2. Select the principal to connect to the database:

    • Yourself, as an IAM user.
    • An application that you previously created in the IAM section of the console.

    Refer to the IAM documentation for more information on identities and access rights.

  3. Set up the connection string or connection parameters:

    • If you already have a secret key, replace the [INSERT_SECRET_KEY_HERE] placeholder with your key.
    • If you do not have a secret key, click Generate new secret key.
  4. Copy your connection string or parameters and store them securely.

How to connect to a database as a user

  1. Run the following command in a terminal (including the " characters):


    An output similar to the following response displays:

    psql (15.3, server 14.8 (Debian 14.8-1pgsg120+1))
    SSL connection (protocol: TLSv1.3, cipher: TLS_AES_128_GCM_SHA256, compression: off)
    Type "help" for help.
  2. Run the following command to see the version of your Serverless SQL Database:

    SELECT version();

    An output similar to the following displays:

    PostgreSQL 14.8 (Debian 14.8-1.pgdg120+1) on x86_64-pc-linux-gnu,
    compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
  3. Press q to quit the version overview.

You can now perform the authorized actions in the database.

How to connect an application to a database

Use the connection parameters (host, port, user, password, and database name) previously saved to connect your application to the database.


Connection methods may vary depending on the framework or library used in your application. Refer to the corresponding official documentation for more information.

See also
How to create a Serverless SQL DatabaseHow to add users to a Serverless SQL Database
Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
  • Blog
  • Careers
  • Scaleway Learning
Scaleway Docs
Follow us
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS