Before you start to use your ApsaraDB RDS for PostgreSQL instance, you must create databases on the RDS instance. This topic describes how to create a database on an ApsaraDB RDS for PostgreSQL instance.
- Instance: a virtualized database server, on which you can create and manage a number of databases.
- Database: a set of organized data that can be shared by a number of users. A database provides the minimal redundancy and is independent of applications. You can consider a database to be a warehouse that is used to store data.
- Character set: a collection of letters, special characters, and encoding rules that are used in a database.
- If the RDS instance uses standard or enhanced SSDs, you can create and manage databases in the ApsaraDB RDS console.
- If the RDS instance uses local SSDs, you can create and manage databases by using SQL statements.
- If you want to migrate data from an on-premises database to the RDS instance, you must create a database and an account on the RDS instance. The created database must have the same name as the on-premises database. The created account must have the same name as the account that is authorized to manage the on-premises database.
Create a database for an RDS instance with standard or enhanced SSDs
- Visit the RDS instance list, select a region above, and click the target instance ID.
- In the left-side navigation pane, click Accounts
- Click Create Account.
- Configure the following parameters.
Parameter Description Database Name
- The name of the database can contain up to 64 characters.
- The name of the database can contain lowercase letters, digits, hyphens (-), and underscores (_).
- The name of the database must start with a lowercase letter and end with a lowercase letter or digit.
Supported Character Set The character set that is supported by the database. Collate The rule that is used to sort strings. Ctype The type of character that is supported by the database. Authorized Account: The owner of the database. The owner has all permissions on the database. Description The description of the database.
- Click Create.
Create a database for an RDS instance with local SSDs
- Log on to the ApsaraDB RDS console.
- In the SQL window, execute the following statement to create a database:
CREATE DATABASE name [ [ WITH ] [ OWNER [=] user_name ] [ TEMPLATE [=] template ] [ ENCODING [=] encoding ] [ LC_COLLATE [=] lc_collate ] [ LC_CTYPE [=] lc_ctype ] [ TABLESPACE [=] tablespace_name ] [ CONNECTION LIMIT [=] connlimit ] ]
For example, if you want to create a database named test, execute the following statement:
create database test;
What to do next
Connect to the RDS instance. For more information, see Connect to an ApsaraDB RDS for PostgreSQL instance.