Skip to content

Instantly share code, notes, and snippets.

@Dezinger
Last active May 17, 2020 18:35
Show Gist options
  • Save Dezinger/7341992 to your computer and use it in GitHub Desktop.
Save Dezinger/7341992 to your computer and use it in GitHub Desktop.
Manage postgres server
# Fast server stop
sudo -u postgres /usr/pgsql-9.1/bin/pg_ctl -D /var/lib/pgsql/9.1/data stop -m fast
# To create a database instance, after install do
sudo mkdir -p /opt/local/var/db/postgresql93/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql93/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb -D /opt/local/var/db/postgresql93/defaultdb'
#или
sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb --locale=ru_RU.UTF-8 --lc-collate=ru_RU.UTF-8 --lc-ctype=ru_RU.UTF-8 --encoding=UTF8 -D /opt/local/var/db/postgresql93/localdb'
# Success. You can now start the database server using:
/opt/local/lib/postgresql93/bin/postgres -D /opt/local/var/db/postgresql93/defaultdb
# or
/opt/local/lib/postgresql93/bin/pg_ctl -D /opt/local/var/db/postgresql93/defaultdb -l logfile start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment