![]() |
|
Set Up Remote Database Connection in PostgreSQL - Printable Version +- My Board (https://ellohost.com/forum) +-- Forum: Tutoriel EN (https://ellohost.com/forum/forumdisplay.php?fid=8) +--- Forum: Others (https://ellohost.com/forum/forumdisplay.php?fid=20) +--- Thread: Set Up Remote Database Connection in PostgreSQL (/showthread.php?tid=771) |
Set Up Remote Database Connection in PostgreSQL - aaron - 09-08-2023 After configuring the database, set up remote access to PostgreSQL using the psql command. To do so, use this command syntax on the client machine:
For example, run this command to connect to the TheNewUser database hosted on a VPS with the IP address 185.185.185.185 using the TheNewUser account:
Remember that the default PostgreSQL port is 5432. To verify if the connection is successful, run this command:
Once connected, you can send database queries to retrieve data. To enable PostgreSQL remote access in your application, install a database driver and import the module into your code. For this tutorial, we will show you how to do so in a Python application hosted on an Ubuntu 20.04 VPS. After connecting via SSH, follow these steps:
|