Difference between revisions of "Postgres:Database Creation"

From Earlham CS Department
Jump to navigation Jump to search
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
# Make sure the user that will be using the database is created ([[Postgres:User Creation|Creating a user]])
 
# Make sure the user that will be using the database is created ([[Postgres:User Creation|Creating a user]])
# Either as the "pgsql" user, or as the user that will be using the db, run <tt>createdb</tt>
+
# Either as the "postgres" user, or as the user that will be using the db, run <tt>createdb</tt>
 
#* <tt>createdb</tt> can be run with no paramenters, in which case a database is created who's name and owner are that of the current user.
 
#* <tt>createdb</tt> can be run with no paramenters, in which case a database is created who's name and owner are that of the current user.
 
#* Syntax is: <tt>createdb <Options> ''dbname'' ''description''</tt>
 
#* Syntax is: <tt>createdb <Options> ''dbname'' ''description''</tt>
Line 11: Line 11:
 
#*# -T ''template'': Specify template database to use
 
#*# -T ''template'': Specify template database to use
 
# All this and more can be found by typing <tt>man createdb</tt> at a prompt.
 
# All this and more can be found by typing <tt>man createdb</tt> at a prompt.
 +
 +
[https://wiki.cs.earlham.edu/index.php/Sysadmin:Psql-setup Setting up a simple user DB for classes]

Latest revision as of 13:09, 2 October 2023

  1. Make sure the user that will be using the database is created (Creating a user)
  2. Either as the "postgres" user, or as the user that will be using the db, run createdb
    • createdb can be run with no paramenters, in which case a database is created who's name and owner are that of the current user.
    • Syntax is: createdb <Options> dbname description
    • Options:
      1. -D tablespace: Specify default tablespace
      2. -e: Echos the command that createdb generates
      3. -E encoding: Specify character encoding to be used
      4. -O owner: Specify
      5. -q: Do not desplay a response
      6. -T template: Specify template database to use
  3. All this and more can be found by typing man createdb at a prompt.

Setting up a simple user DB for classes