Skip to content

Commit

Permalink
Merge pull request MicrosoftDocs#18778 from JasonWHowell/PostgresUsab…
Browse files Browse the repository at this point in the history
…ility

PostgreSQL: Usability Study adjustments
  • Loading branch information
MattGLaBelle authored Aug 7, 2017
2 parents e15b0d2 + 6666c1c commit acac9c1
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions articles/postgresql/quickstart-create-server-database-portal.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,45 @@ There are a number of applications you can use to connect to your Azure Database

![Azure Database for PostgreSQL - Azure Shell Bash Prompt](./media/quickstart-create-database-portal/8-bash.png)

3. At the Cloud Shell prompt, connect to your Azure Database for PostgreSQL server by typing the psql command line at the prompt. The following format is used to connect to an Azure Database for PostgreSQL server with the [psql](https://www.postgresql.org/docs/9.6/static/app-psql.html) utility:
```bash
psql --host=<myserver> --port=<port> --username=<server admin login> --dbname=<database name>
```
3. At the Cloud Shell prompt, connect to a database in your Azure Database for PostgreSQL server by typing the psql command line at the green prompt.

For example, the following command connects to the default database called **postgres** on your PostgreSQL server **mypgserver-20170401.postgres.database.azure.com** using access credentials. Always use port **5432** when connecting. Enter your server admin password when prompted. Please use spaces between the --switches in the command as shown, but do not use spaces between the equal signs and the parameter values.
The following format is used to connect to an Azure Database for PostgreSQL server with the [psql](https://www.postgresql.org/docs/9.6/static/app-psql.html) utility:
```bash
psql --host=<yourserver> --port=<port> --username=<server admin login> --dbname=<database name>
```

```bash
psql --host=mypgserver-20170401.postgres.database.azure.com --port=5432 --username=mylogin@mypgserver-20170401 --dbname=postgres
```
4. Once you're connected to the server, create a blank database at the prompt.
```bash
CREATE DATABASE mypgsqldb;
```
For example, the following command connects to an example server:

```bash
psql --host=mypgserver-20170401.postgres.database.azure.com --port=5432 --username=mylogin@mypgserver-20170401 --dbname=postgres
```

psql parameter |Suggested value|Description
---|---|---
--host | *server name* | Specify the server name value that was used when you created the Azure Database for PostgreSQL earlier. Our example server shown is mypgserver-20170401.postgres.database.azure.com. Use the fully qualified domain name (\*.postgres.database.azure.com) as shown in the example. Follow the previous section to get the connection information if you do not remember your server name.
--port | **5432** | Always use port 5432 when connecting to Azure Database for PostgreSQL.
--username | *server admin login name* |Type in the server admin login username supplied when you created the Azure Database for PostgreSQL earlier. Follow the previous section to get the connection information if you do not remember the username. The format is *username@servername*.
--dbname | **postgres** | Use the default system generated database name *postgres* for the first connection. Later you create your own database.

After running the psql command, with your own parameter values, you will be prompted to type the server admin password. This is the same password that you provided when you created the server.

psql parameter |Suggested value|Description
---|---|---
password | *your admin password* | Note, the typed password characters will not be shown on the bash prompt. Press enter after you have typed all the characters to authenticate and connect.

4. Once you're connected to the server, create a blank database at the prompt by typing the following command:
```bash
CREATE DATABASE mypgsqldb;
```
5. At the prompt, execute the following command to switch connection to the newly created database **mypgsqldb**.
```bash
\c mypgsqldb
```
```bash
\c mypgsqldb
```
6. Type \q and then press ENTER to quit psql. You can close the Azure Cloud Shell.
Now you have connected to the Azure Database for PostgreSQL and created a blank user database. Continue to the next section to connect using another common tool pgAdmin.
## Connect to PostgreSQL database using pgAdmin
Expand Down

0 comments on commit acac9c1

Please sign in to comment.