> ## Documentation Index
> Fetch the complete documentation index at: https://thenile.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting to Postgres using PSQL

This guide will walk you through the steps to connect to Nile using PSQL.

1. Create a Nile's Postgres database through the UI or use one of your existing databases to follow along.

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-1.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=c0ffc9005b2f153d12ec89736f84dc00" alt="PSQL-1" width="2876" height="1464" data-path="images/psql-1.png" />

2. Once you are inside a specific database, click on the settings tab on the left and navigate to the connections screen

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-2.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=83d6573e2bcb6e0d85385d46e4d162eb" alt="PSQL-2" width="2858" height="1446" data-path="images/psql-2.png" />

3. Click on the Postgres icon to get the connection string

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-3.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=372af70ef91b7b9a3474454abda050bd" alt="PSQL-3" width="2864" height="1450" data-path="images/psql-3.png" />

4. Click "Generate credentials". Use this if you really want to simplify the access. If not, you can replace the username and password manually and use that through commandline.

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-4.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=17998645dad495f870aacefd5ca23870" alt="PSQL-4" width="2862" height="1448" data-path="images/psql-4.png" />

5. Copy the connection string and run it on the command line.

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-5.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=1b991ed404fdb5b5388b990a56cb4a05" alt="PSQL-5" width="2866" height="1456" data-path="images/psql-5.png" />

6. You can now use the full power of psql with Nile. You can take a look at all the tables and schemas using \dt

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-6.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=b6c7fc84e8061de0b914000e502a68e5" alt="PSQL-6" width="2816" height="1502" data-path="images/psql-6.png" />

7. Execute any queries to interact with the tables. For example, if you want to see the rows in tenants table, execute a select query on it

<img src="https://mintcdn.com/nile/ZhObK_CvFMgzM-yj/images/psql-7.png?fit=max&auto=format&n=ZhObK_CvFMgzM-yj&q=85&s=afc3bc46ec90082bdff2c6e1366c885b" alt="PSQL-7" width="2812" height="1498" data-path="images/psql-7.png" />

8. Have fun using PSQL!
