Creating a Database Using Commands
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 instance has been connected. For details, see "Connecting to an Instance over a Public Network" and "Connecting to an Instance over 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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot