i want to hand in a course work for marking but i have no idea what files represent the database. Question: Where can i find the postgres sql database on my hard disk? Thanks.
4 Answers
Checkout the startup parameter -D for the Postgres service. It defines where the data directory is located.
Edit:
To hand in your homework, you'd better export the database using pg_dump as WoLpH suggested. The actual files in the data directory are binary files and I bet your teacher want's to have SQL scripts
The database files are in what is called the "data" directory. Depending on your environment there are a few ways to tell - here is one that should work everywhere:
psql -d database_name_here -c "show data_directory"
And if you're turning this in for some school work you should:
pg_dump -d database_name_here
If installed by apt-get
or similar package manager, most likely in
/usr/local/pgsql/data