How to Create a PostgreSQL Database in China?
Tags: postgres, china, webdev
Published: 2021-03-02 17:18:38

---
canonical_url: https://www.21cloudbox.com/solutions/how-to-create-a-postgresql-database.html
---
# What is PostgreSQL?
PostgreSQL is older but very powerful open source relational database. PostgreSQL supports most of the SQL standards and provides many other modern features such as complex queries, foreign keys, triggers, views, transaction integrity, and so on. Generally it is loved by developers of [startups around the world](https://stackshare.io/postgresql).

[21YunBox](https://www.21yunbox.com/) provides a fully managed (free of operations and maintenance) PostgreSQL database.

# How to Create a PostgreSQL Database in China?

1. Register as [21YunBox member](https://www.21yunbox.com/u/signup/)
2. Select "Database" in the console
3. Then click "Add Database"
4. Create with the following configuration

| Options           | Explanation                                         |
| ----------------- | :-------------------------------------------------: |
| **Database**.     | Give the currently created database instance a name |
| Database name.    | The name of the database when connecting to the database. If not specified, the system will automatically generate it. |
| Database Username | The username of the database when connecting to the database. If not specified, the system will automatically generate it. |

> Note: **Database name** and **Database user name** cannot be changed once created.

You will find that in the above configuration, the database password is not filled in. This is because the system will automatically generate it and no additional filling is required.

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uek4g6murgm2ht1iz56a.png)*Create a PostgreSQL database showing a configuration screenshot*

If you are not sure how to do it, you can see an example in this video: [How to create a PostgreSQL database operation example](https://www.bilibili.com/video/BV1gr4y1T7ku)

## How to Remotely Connect to the Database?

In most cases, we connect to the database to: add, delete, modify or search and other actions that are connected by code.
We have automatically spliced ​​the URL connected to the database, to complete the configuration, you only need to paste it .

### How to Connect to the Database Under the Intranet?
Under the intranet of 21YunBox, you can directly use **database URL** to connect.

For details, please refer to the database connection section:
- Python Flask or Django project, please refer to [How to deploy Django project to the server](https://launch-in-china.21yunbox.com/solutions/how-to-deploy-django-project-in-production-server.html)?
- PHP Laravel project, please refer to [How to deploy Laravel project to server](https://launch-in-china.21yunbox.com/solutions/how-to-deploy-laravel-project-in-production-server.html)?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mlqdkzscx91g6d4krzv.png) *Screenshot of PostgreSQL after creation*


### How to connect to a Database Under the External Network?
Under 21YunBox's external network, you can use the client visual interface tools such as [DBeaver](https://dbeaver.io/), or [Postico](https://eggerapps.at/postico/), or directly use **command line** to connect.

If you are not sure what to do or would like to see a step by step example, please watch the following videos:
1. Use DBeaver to connect to the database video:
[Use DBeaver to connect to the database](https://www.bilibili.com/video/BV1cp4y1x7Ge)

2. Use the command line to connect to the database video:
[Use the command line to connect to the database](https://www.bilibili.com/video/BV1ga4y1H7cJ)


## How to Backup the Database?
21YunBox provides 7 days of free cloud database backup, which is rolled daily and stored in a multi-backup cloud disk in `.dump` format.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0gumcr3jdai97holo8v1.png) *An example of a PostgreSQL backup file after creation*

# Why Choose 21YunBox?

> 21YunBox is a Cloud Service platform based out of Beijing. Our services enable your team to be more effective in leveraging the growing opportunity within China by hosting your sites at blazing speeds with an operational and maintenance free, and low code solution.
>
> 21YunBox provides an easy and budget friendly, end-to-end web platform deployment service for all applications from small teams to large enterprises.
We also offer [full support in obtaining your ICP license]({% post_url 2021-02-12-how-to-get-an-icp %}) allowing you to legally host online content inside of Mainland China.


To learn about the differences between 21YunBox and these foreign (outside of China) cloud service platforms, please refer to:

* [21YunBox vs Heroku](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-heroku-in-china.html)
* [21YunBox vs Netlify](https://launch-in-china.21yunbox.com/blog/solutions/alternatives-to-netlify-in-china.html)
* [21YunBox vs Vercel](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-vercel-in-china.html)
* [21YunBox vs Gatsby Cloud](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-gatsby-cloud-in-china.html)
* [21YunBox vs Github Pages](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-github-pages-in-china.html)
* [21YunBox vs Surge.sh](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-surgesh-in-china.html)
* [Compare in terms of function and price: 21YunBox vs Heroku, Netlify, Vercel](https://www.21yunbox.com/compare-others/)


<br>
*This article's content originated [here](https://launch-in-china.21yunbox.com/solutions/how-to-create-a-postgresql-database.html)*

*For additional detail and future modifications, refer the original post.*