Connect PostgreSQL Database in Laravel with pgAdmin + Hosting
2 min readMar 22, 2023
PostgreSQL also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.
Now we will connected PostgreSQL with Laravel 9 via pgAdmin 4 and Hosting Database
- Download pgAdmin
Link Download : https://www.pgadmin.org/download/
2. Upload database on your hosting
3. Configuration database in pgAdmin
3.1 Click Add New Server
3.2 On Tab General, fill Name with your domain
3.3 On Tab Connection, fill in as follows
Host name/address : 127.0.0.1
Port : 5432
Maintenace database : yourdbname
Username : yourusernamedb
Password : yourpassworddb
3.4 On Tab SSH Tunnel, fill in as follows
Use SSH tunneling : active
Tunnel Host : yourdomain.com
Tunnel Port : 64000 or SSH Port
Username : username cpanel
Password : password cpanel
3.5 Click Save
And you see your database in pgAdmin
4. Configuration Laravel on File .env
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=49262 or you can check on pgAdmin Properties (see picture B)
DB_DATABASE=yourdbname
DB_USERNAME=yourusernamedb
DB_PASSWORD=yourpassworddb
5. Run Laravel