createdb
    
    Application
  
  
    
      createdb
    
    
      Create a new Postgres database
    
  
  
    
      1998-10-02
    
    
      createdb [ dbname ]
      createdb [ -h host ] [ -p port ]
      [ -D datadir ]
      [ -u ] [ dbname ]
    
    
    
      
	1998-10-02
      
      
	Inputs
      
      
	
	
	  
	    
	      -h host
	    
	    
	      
		Specifies the hostname of the machine on which the 
		postmaster
		is running.  Defaults to using a local Unix domain socket
		rather than an IP connection..
	      
	    
	  
	  
	    
	      -p port
	    
	    
	      
		Specifies the Internet TCP/IP port or local Unix domain socket file 
		extension on which the postmaster
		is listening for connections.  The port number defaults to 5432,
		or the value of the PGPORT
		environment variable (if set).
	      
	    
	  
	  
	  
	    
	      -u
	    
	    
	      
		Use password authentication. 
		Prompts for
		username
		and password.
	      
	    
	  
	  
	  
	    
	      -D datadir
	    
	    
	      
		Specifies the alternate database location for this database installation.
		This is the location of the installation system tables, not the location
		of this specific database, which may be different.
	      
	    
	  
	  
	  
	    
	      dbname
	    
	    
	      
		Specifies the name of the database to be created.  The name must be
		unique among all Postgres databases in this installation.
		dbname
		defaults to the value of the
		USER
		environment variable.
	      
	    
	  
	  
	
      
    
    
      
	1998-10-02
      
      
	Outputs
      
      
	createdb will create files in the
	PGDATA/dbname/
	data area for the new database.
	
	
	  
	    
	      Connection to database 'template1' failed.
	      connectDB() failed: Is the postmaster running and accepting connections
	      at 'UNIX Socket' on port 'port'?
	      createdb: database creation failed on dbname.
	    
	    
	      
		createdb could not attach to the 
		postmaster 
		process on the specified host and port.  If you see this message,
		ensure that the postmaster 
		is running on the proper host and that you have specified the proper
		port.  If your site uses an authentication system, ensure that you
		have obtained the required authentication credentials.
	      
	    
	  
	  
	  
	    
	      Connection to database 'template1' failed.
	      FATAL 1:  SetUserId: user 'username' is not in 'pg_shadow'
	      createdb: database creation failed on dbname.
	    
	    
	      
		You do not have a valid entry in the relation pg_shadow
		and and will not be allowed to access Postgres. 
		Contact your Postgres administrator.
	      
	    
	  
	  
	  
	    
	      ERROR:  user 'username' is not allowed to create/destroy databases
	      createdb: database creation failed on dbname.
	    
	    
	      
		You do not have permission to create new databases.
		Contact your Postgres site administrator.
	      
	    
	  
	  
	  
	    
	      ERROR:  createdb: database 'dbname' already exists.
	      createdb: database creation failed on dbname.
	    
	    
	      
		The database already exists.
	      
	    
	  
	  
	  
	    
	      createdb: database creation failed on dbname.
	    
	    
	      
		An internal error occurred in psql
		or in the backend server.  Ensure that your site administrator has
		properly installed Postgresand initialized the site with 
		initdb.
	      
	    
	  
	  
	
      
      
	
	  createdb internally runs
	  CREATE DATABASE from psql
	  while connected to the template1 database.
	
      
    
  
  
  
    
      1998-10-02
    
    
      Description
    
    
      createdb creates a new 
      Postgres database.
      The person who executes this command becomes
      the database administrator, or DBA,
      for this database and is the only
      person, other than the Postgres super-user,
      who can destroy it.
    
    
      createdb is a shell script that invokes
      psql.
      Hence, a postmaster
      process must be running on the database server host before
      createdb
      is executed. The 
      PGOPTION
      and
      PGREALM
      environment variables will be passed on to
      psql
      and processed as described in .
    
  
  
  
    
      1998-10-02
    
    
      Usage
    
    
      To create the database demo
      using the postmaster on the local host, port 5432:
      
      
	createdb demo
      
      
      To create the database demo
      using the postmaster on host eden, port 5000:
      
      
	createdb -p 5000 -h eden demo