Getting started with PostgreSQL

Using Your Databases

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

Overview

Prerequisites

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

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 Web Control Panel.

There is also a guide here: Getting started with the CloudDB service

Connect via the command line

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

Connect from a PHP script

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 Aliases, then on +

launch SQuirreL SQL

  • Fill in the fields below and then confirm by clicking OK :
    • 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

  • Confirm again by clicking the button Connect

valid connection

You will now be connected to your database:

config connection

Connecting via phppgAdmin

Soon available in another guide.

Export a PostgreSQL database

Export your database via the command line

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

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

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.


These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices incl. VAT may vary according to the customer's country of residence
(by default, the prices displayed are inclusive of the UK VAT in force).