Creating a Database Using Commands
Scenarios
A database is a collection of tables, indexes, views, stored procedures, and operators. To make it easier to manage DDS DB instances, you can create a database by running commands on the newly-created DB instance. If the database does not exist, create the database and switch to the new database. If the database exists, directly switch to the database.
Prerequisites
A DDS DB instance has been connected. For details, see section "Connecting to a DB Instance Through a Public Network" and "Connecting to a DB Instance Through a Private Network" in Document Database Service Getting Started.
Procedure
- Create a database.
use dbname
dbname: indicates the name of the database to be created.
Figure 1 Creating databases
- After a database is created, insert data into the database so that you can view the database in the database list.
Figure 2 Inserting data
There are three system databases created by default: admin, local, and test. If you directly insert data without creating a database, the data is inserted to the test database by default.Figure 3 Viewing the database
- View data in the database.
Figure 4 Viewing data
Last Article: Creating a Database Account Using Commands
Next Article: Resetting the Administrator Password
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.