Warning: is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/data/web/virtuals/98151/virtual) in /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/wp-simple-firewall/src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Fs.php on line 465

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/wp-simple-firewall/src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Fs.php:465) in /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/disable-xml-rpc-pingback/disable-xml-rpc-pingback.php on line 51
Default "postgres" database - how to re-create it - PostgreSQL Candies

From time to time happens that someone pollutes default “postgres” database with some unwanted stuff like import of objects intended for some other database. Or it may even happen that someone drops it. If so you can easily create or re-create new default “postgres” database.

on Debian/Ubuntu:

  • sudo su postgres
  • psql -d someotherdatabase
  • \l+
    • you will see list of all databases with sizes
  • drop database postgres;
  • \q
    • exit psql tool into command like again
  • createdb postgres
    • creates new postgres database
  • psql
  • \l+
    • check databases again
  • \q
    • exit psql
  • exit
    • exit postgres user