This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing basic steps for changing the default Windows Data Directory of the PostgreSQL in Linux.
When we install PostgreSQL on Linux operating system, by default it stores in “/var/lib/postgresql/[version]/data/”
Always best practice is to store database data on the separate drive instead of the system drives.
PostgreSQL: Change or Move Default Data Directory in Windows
Create a new directory:
1 |
mkdir postgres_data_dir |
Give directory ownership to your Linux user:
1 |
chown user_name postgres_data_dir |
Log in with your postgres user and initialize the database at the new location:
1 |
initdb -D /postgres/test/postgres_data_dir |
OR
STOP and then START Postgres with new data directory:
1 |
postgres -D /postgres/test/postgres_data_dir |
Leave a Reply