Home > Net >  How to set default database name when creating a cluster
How to set default database name when creating a cluster

Time:06-06

When creating a cluster using initdb

$ initdb -D /usr/local/pgsql/data

it creates a default database user postgres and database name postgres.

I need to create a cluster with a different superuser name and default database name. I found the way to have a different name for superuser:

$ initdb --username=myuser

But can't find how to define the different name for the database instead of postgres. How can I do that? Is my only option is to rename the default DB after it's been created?

CodePudding user response:

Creating the database "postgres" is hardcoded in the initdb-code. You could build your own version of initdb and use a different name for this specific database or you run a script afterwards that renames this database.

  • Related