--- id: connection-strings title: "Connection Strings" slug: connection-strings custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml --- import Tabs from '@theme/Tabs'; import TabsPanel from '@theme/TabsPanel'; There are various ways to connect to your database, depending on the configuration of your Postgres instance and the tool which you are connecting with. ```bash postgres://postgres:postgres@localhost:5432/postgres # or postgresql://postgres:postgres@localhost:5432/postgres ``` ## Notes - [Official Documentation](https://www.postgresql.org/docs/current/libpq-connect.html). - Avoid using special characters usernames and passwords. If you use special characters in a connection URL, you'll need to URL encode any special characters. ## Examples ### Basic connection string If you're using a default setup, your postgres connection string will likely be in the format: `postgres://{user}:{password}@{host}:{port}/{database_name}` ```bash postgres://postgres:postgres@localhost:5432/postgres # or postgresql://postgres:postgres@localhost:5432/postgres ``` ### JDBC See full [documentation](http://jdbc.postgresql.org/documentation/head/connect.html). ```bash jdbc:postgresql://{host}:{port}/{database_name} ``` ### ADO.NET See full [documentation](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html). ```bash Server=host;Port=5432;User Id=username;Password=secret;Database=database_name; ``` ### PHP See full [documentation](http://php.net/manual/en/book.pgsql.php). ```bash host=hostname port=5432 dbname=databasename user=username password=secret ```