Last active
June 23, 2020 16:56
-
-
Save edwardstock/56f6b929e70cbf308d04a2a636b3e1c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init new database | |
# dir: /usr/pgsql-$VERS | |
initdb -A trust --auth-local=trust --encoding=UTF8 --pgdata=/var/pgsql10 | |
# dump old database (-O [--no-owners] - drops owners assignment, by default in new db's rights will grant to importer) | |
pg_dumpall -O -U postgres > /var/db.out | |
# import database dump | |
psql -f db.out postgres | |
# create user | |
createuser -d -l -P USERNAME | |
# createdb to user | |
createdb --encoding=UTF8 --owner=USERNAME DBNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment