Skip to content

Instantly share code, notes, and snippets.

@tralston
Created August 21, 2017 08:18
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save tralston/f48636cfffbe33502b5dd26528ccdd2a to your computer and use it in GitHub Desktop.
Save tralston/f48636cfffbe33502b5dd26528ccdd2a to your computer and use it in GitHub Desktop.
[Reload PostgreSQL config] After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. #postgres

After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:

service postgresql restart

When the service command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres).

user#  sudo su postgres
postgres#  pg_ctl reload

If it complains about not having a data directory, you'll have to do it from within PostgreSQL itself.

psql -U postgres
postgres=> SELECT pg_reload_conf();

If that doesn't work (like modiying the listening addresses or ports) then you may just have to restart the machine. If it doesn't autostart, start the postgresql service/process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment