---
title: "Getting started with PostgreSQL"
description: "Using Your Databases"
url: https://docs.ovhcloud.com/en/guides/web-cloud/databases/db-getting-started-postgresql
lang: en
lastUpdated: 2023-02-15
---
# Getting started with PostgreSQL

Do you want to use PostgreSQL? Learn how to easily manage your databases!

## Overview

### Prerequisites

- A Web Cloud Databases instance
- To have viewed [the Web Cloud Databases guide](/en/guides/web-cloud/databases/db-getting-started.md)

### What is a PostgreSQL database?

PostgreSQL is an object-relational database management system (ORDBMS). It's a reliable and extensible system, which can manipulate large volumes of data. It also has a very active community.

## Logging in to the database

:::info
Please note that this service does not give you access to the Host but to the databases hosted on the Host. Generic SQL commands work with no issues, and HeidiSQL or SQuirreL SQL software is fully compatible.

:::

To log in to your database, make sure that you have:

- The address of your database instance
- Your database port
- Your database username
- Your database password
- Your database name

All this information is available in the OVHcloud Control Panel
.
There is also a guide here: [Getting started with the Web Cloud Databases service](/en/guides/web-cloud/databases/db-getting-started.md)

### Connect via the command line

```bash
psql --host=server --port=port --user=user --password=password database_name
```

### Connect from a PHP script

```php
1. <?php
2. $myPDO = new PDO('pgsql:host=host;port=port;dbname=dbname', 'username', 'password');
3. ?>
```

### Connect from software (SQuirreL SQL)

- Launch SQuirreL SQL and click on <code className="action">Aliases</code>, then on <code className="action">+</code>

![launch SQuirreL SQL](/images/assets/screens/other/web-tools/squirrel/aliases.png)
- Fill in the fields below and then confirm by clicking <code className="action">OK</code> :
  - **Name**: Choose a name
  - **Driver**: Choose "PostgreSQL"
  - **URL**: Enter the server address and port in the following form jdbc:postgresql://server:port/database
  - **User Name**: Enter the username
  - **Password**: Enter the password

![config connection](/images/assets/screens/other/web-tools/squirrel/add-alias-pgsql.png)
- Confirm again by clicking the button <code className="action">Connect</code>

![valid connection](/images/assets/screens/other/web-tools/squirrel/connect-to-pgsql.png)
You will now be connected to your database:

![config connection](/images/assets/screens/other/web-tools/squirrel/general-dashboard-pgsql.png)
### Connecting via phppgAdmin

_Soon available in another guide._

## Export a PostgreSQL database

### Export your database via the command line

```bash
pg_dump --host=server --port=port --user=username --password=password database_name > database_name.sql
```

## Import a PostgreSQL database

### Import your database via the command line

```bash
psql --host=server --port=port --user=user --password=password database_name < database_name.sql
```

## Go further

For specialised services (SEO, development, etc.), contact [OVHcloud partners](https://partner.ovhcloud.com/en-gb/directory/).

If you would like assistance using and configuring your OVHcloud solutions, please refer to our [support offers](https://www.ovhcloud.com/en-gb/support-levels/).

Join our [community of users](https://community.ovhcloud.com/).
