![]() ![]() The very first step to get started with any database is to learn how to create a database. For example: pg_createcluster -locale de_DE.UTF-8 -start 11 mainĬheck the Locale page to see how to add more locales.PostgreSQL offers a couple of ways to create a new database. Run the following command: pg_dropcluster -stop main For example: pg_dropcluster -stop 11 main.Perform this operation right after you have installed the base package. The following operation obviously deletes everything you had in cluster databases. To change the locale (and possibly other options in initdb), delete the existing default cluster and create a new one: it initializes the cluster with default encoding and locale. Starting the database engine creates log file with name postgresql-.log.ĭebian PostgreSQL installation automatically calls initdb i.e. Log files: Installing PostgreSQL creates log directory /var/log/postgresql/. Note that Debian allows multiple clusters and even different versions of PostgreSQL to co-exist in same host.Ĭonfiguration files: /etc/postgresql///ĭata files: /var/lib/postgresql// It calls pg_ctlcluster internally.ĭebian splits the database configuration from the database files, opposed to generic PostgreSQL installation that puts everything under same directory. It can be used to start, stop, restart and reload the system. To customize the behavior check the /etc/postgresql///pg_ctl.confĭebian installs SysV-init compatible (standard) start-up script /etc/init.d/postgresql. Use the pg_ctlcluster whenever you need the pg_ctl. Debian has made a Perl-wrapper for the pg_ctl called /usr/bin/pg_ctlcluster. Pg_ctl is a PostgreSQL command line control program that can be used to control the database. Use pg_lsclusters command to check installed clusters and obtain some basic information such as: version (major version), name, port, status (online or down), owner, data directory and log file. Once the package is installed, to get more information look at /usr/share/doc/postgresql-doc-/tutorial/README. PostgreSQL documentation points to tutorial, which is included in the postgresql-doc package. To get an overview about Debian's PostgreSQL architecture, instructions for a quick start, and pointers to the programs and manpages, have a look at /usr/share/doc/postgresql-common/. ![]() See /usr/share/doc/postgresql-common/ section "Default clusters and upgrading" More info on the syntax can be found here : Now you can easily connect with $ psql -d mypgdatabase -h localhost -U mypguser $ psql -d mypgdatabase -h localhost -U mypguserĪdd line for auth : $ echo 'hostname:port:mypgdatabase:mypguser:mypgpassword' > ~/.pgpass Or, if the OS user name is not the same as the database user name: $ createuser -pwprompt mypguser #from regular shellĬonnect as user mypguser to new database # su - mypguser Switch to user postgres and create a new database user and a database: # su - postgres If your system uses sudo to get administrative rights: $ sudo -u postgres psqlĬreate a regular system user account using adduser (skip this step to use an existing account): # adduser mypguser #from regular shell Search Debian packages to find the list of possibilities:īoth the default database user and default database are called postgres. Please note that the procedural languages are installed separately (plpgsql comes by default). Phppgadmin - PostgreSQL web-based administration tool. Postgresql-doc - PostgreSQL documentation. ![]() # apt install postgresql postgresql-client Required packages: postgresql postgresql-client ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |