Linux (commonly pronounced LIH-N?ks in English; variants exist) is a Unix-like computer operating system. Linux is one of the most prominent examples of free software and open source development: typically all underlying source code can be freely modified, used, and redistributed by anyone.

Tags | | | |

Move postgres database

One question I have seen a lot when dealing with PostgreSQL is, "How do I move the physical database location?". IE from /var/lib/postgresql/8.3/main to /database/...



This is pretty easy to do starting with PostgreSQL 8.3.



# vim /etc/postgresql/8.3/main/postgresql.conf



Locate the line data_directory and change that path to your desired new path



cp /var/lib/postgresql/8.3/main/ * /new-path;chown -R postgres /new-path;chmod -R 700 /new-path;/etc/init.d/postgresql-8.3 restart



That should do it



Comments

Feel free to leave a comment or question

Name: (Optional but appreciated):

Comment:

Use [code] [/code] for code block style



Security Code: