
ZeaburPostgreSQL (often referred to as Postgres) is a powerful, open-source object-relational database system. It is widely admired for its reliability, robust feature set, and adherence to SQL standards. It is the go-to choice for applications requiring complex queries, ACID compliance, and strict data integrity.
Zeabur makes managing relational databases effortless. With Zeabur, you can launch a production-ready PostgreSQL instance in seconds without dealing with complex configuration files, storage volumes, or server maintenance.
In this tutorial, we will guide you through:
Zeabur offers a "one-click deployment", meaning you rarely need to configure complex settings manually.
Option 1: Create Postgresql instance from Project page
PostgreSQL.Option 2: Create Postgresql instance from template page
Features and Template.PostgreSQL.PostgreSQL (usually the official image) click deploy and it will start deploying.postgres.zeabur.app)5432 or a randomized port)root or postgres)postgres)Before you open any tool, ensure you have your connection details ready from the Zeabur Dashboard.
Best for: Developers who want to write code and check the database in the same window.
Step 1: Install Extensions
Ctrl+Shift+X or Cmd+Shift+X).Step 2: Create Connection
+).Step 3: Configure Settings Fill in the form using your Zeabur details:
Zeabur DB (or any name you like)Server and Portpostgres).Step 4: Test and Connect
Best for: Comprehensive database management using the standard, open-source interface used by database administrators.
Step 1: Install pgAdmin
Step 2: Register Server
Step 3: Enter Credentials A pop-up window will appear. You need to fill in two tabs:
Zeabur App DB).xxxx.clusters.zeabur.com).postgres).root).Require or Prefer.Step 4: Connect
> next to your server name > Databases > postgres > Schemas > public > Tables to view your data.When you deploy your application (the one you made in AI Studio/GitHub) to Zeabur, it needs to talk to this database. You should use Private Networking for better security and speed.
Zeabur automatically exposes connection strings to other services in the same project. In your App Service settings:
Go to the Variables tab.
Add a new variable named DATABASE_URL (or whatever your code uses).
For the value, use the Zeabur reference variable:This automatically pulls the secure, internal connection string.
${POSTGRES_CONNECTION_STRING}
If you need specific parts of the connection (or have multiple DBs), use these variables:
${POSTGRES_HOST} (Your DB hostname, usually ending in .zeabur.internal)${POSTGRES_PORT}${POSTGRES_USERNAME}${POSTGRES_PASSWORD}Note: If your project contains multiple PostgreSQL instances, reference variables might be unreliable. In that case, manually copy the "Internal" Hostname and Port from the Networking tab.
If you need to tweak specific database settings (like memory limits or logging):
/etc/postgresql/postgresql.conf.Zeabur performs automatic backups. To restore one:
Download: Download and extract the backup file from Zeabur's backup storage. You will get a data.sql file.
Prepare: Ensure you have PostgreSQL client tools installed on your local machine.
Run Command: Find your "PostgreSQL Connect Command" in the Instructions tab and run this in your terminal:Example: psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql
<Your PostgreSQL Connect Command> < data.sql
Warning: Restoring a backup replaces the existing data and user password. If you want to keep the current password, remove the CREATE ROLE and ALTER ROLE statements from the data.sql file before running the command.