Before you start to use ApsaraDB for RDS, you must create databases and accounts on your RDS instance. This topic describes how to create a database on an ApsaraDB RDS for PostgreSQL instance.
- If your RDS instance uses standard or enhanced SSDs, you can create and manage databases by using the ApsaraDB for RDS console.
- If your 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 your RDS instance, you must create a database and an account on your RDS instance. Make sure that the database and the account have the same names as the on-premises database and its authorized account.
Create a database on an RDS instance equipped with standard or enhanced SSDs
- Log on to the ApsaraDB for RDS console.
- In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the target RDS instance resides.
- Find the target instance and click the instance ID.
- In the left-side navigation pane, click Databases.
- Click Create Database.
- 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 Sets: Specify the character set that is supported by the database. Collate Specify the rule that is used to collate strings in the database. Ctype Specify the type of character that is supported by the database. Authorized Account: Specify the owner of the database. The owner has all permissions on the database. Description: Enter the description of the database.
- Click Create.
Create a database on an RDS instance equipped with local SSDs
- Connect to the RDS instance. For more information, see Connect to an ApsaraDB RDS for PostgreSQL instance.
- 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;