Sudo sh -c 'echo "deb $(lsb_release -cs) pgadmin4 main" > /etc/apt//pgadmin4.list' Run these commands individually to add the pgAdmin official repository:Ĭurl -fsSL | sudo gpg -dearmor -o /etc/apt//pgadmin.gpg.We will use the APT package manager to install it: Install the pgAdmin web-based GUI to simplify your PostgreSQL database management tasks. # Connect your app to the remote database.Ĭonn = nnect(host="182.182.182.182", port="5432", dbname="TestNewUser", user="TestNewUser", password="UserPassword") Remember to change the value accordingly: Add the following line to your application code to import the module and establish a connection with the PostgreSQL database.Download and install the psycopg2 database driver using pip:.Install the pip package manager using this command.After connecting via SSH, follow these steps: To enable PostgreSQL remote access in your application, install a database driver and import the module into your code.įor this tutorial, we will show you how to do so in a Python application hosted in an Ubuntu 20.04 VPS. Once connected, you can send database queries to retrieve data. To verify if the connection is successful, run this command: \conninfo Remember that the default PostgreSQL port is 5423. To do so, use this command syntax in the client machine: psql -h ip_address -p port -d database -U usernameįor example, run this command to connect to the TheNewUser database hosted in a VPS with the 185.185.185.185 IP address using the TheNewUser account: psql -h 185.185.185.185 -p 5432 -d TheNewUser -U TheNewUser
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |