CouchDB: Create Database

In CouchDB, we can create a database either in Fauxton, a built-in web-based interface for admin, or from the terminal using the cURL utility tool.

What is cURL?

cURL stands for "Client URL", and is a command line utility for transfering data using URL syntax over common Internet protocols like HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, DAP, DICT, TELNET, FILE, IMAP, POP3, SMTP and RTSP. It was originally authored by Daniel Stenberg, a Swedish Developer, and was first released in 1997. It is available on a variety of operating systems besides the usual Linux, macOS and Windows.

Besides Fauxton, we will also be using cURL throughout the tutorials to interact with CouchDB via the HTTP protocol.

Create Database in Fauxton

Click on the " Create Database ... " button located on the top bar of your Fauxton's interface.

couchdb create database button

A menu with input opens up prompting to enter a database name.

couchdb create new database menu

We enter a name, say books, and click the "Create" button. A new database is created. Note that the database has zero documents so far.

couchdb new database created

Create Database Using cURL

The above database can also be created using the curl utility tool along with the -X command line option and PUT method over the HTTP protocol with the following command:

					
						sudo curl -X PUT http://127.0.0.1:5984/books
					
				

On successful creation, CouchDB replies:

					
						{"ok":true}
					
				
couchdb new database created