From the course: PostgreSQL: Client Applications

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Create a database

Create a database

- [Lecturer] New databases can be quickly set up using the createdb client application. It uses the same connection parameters as psql in order to connect to the server. So once you've learned them there, you'll be able to apply that knowledge to this tool as well. It all starts with the createdb command. After that, we need to specify where we want to create the new database. So we'll go back to those connection parameters. - h will specify the IP address or the machine name that we want to connect to of the server. So you could say -h localhost. You'll use -p to set the port 5432, and -U to specify the user account that has the authorization to create the new database. I'll use the postgres super-user account. Now we don't need to connect to a specific database in order to create a new database. So there's no need to specify the -D parameter. This will create the new database on the server and assign ownership to the postgres user account. If you wanted to assign a different user as…

Contents