Creating a PostgreSQL Database, the Use of Database Templates, and Simple Command Line Tool Commands
A PostgreSQL server installation includes database templates. These are used when creating new databases. By default, template1 is copied when you create a new database. This makes it easy to create copies of a customized database design. You can customize template1, and then easily make as many copies as you like, and they will all start out with the same objects, such as tables, languages, etc. Specify template0 to create a standard, out-of-the-box database with no custom additions that may have been added to your server installation. Make sure that you do not make any changes to template0. Create a database using template0, from a command line A database can be created in various ways. Here we will create one from the command line, using the tool PostgreSQL createdb. By default, the logged in user will be the owner of a newly created database. While logged in as user postgres, from a command line, create a database named exampledb, using template0: bash-4.2$ createdb...
Comments