Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to find all postgresql and mysql databases on my system? (Perhaps using the find command).

share|improve this question
    
Do you search versions like postgresql-8.3, postgresql-8.5, etc. or do you search where the data is stored? –  user unknown Mar 29 '12 at 18:15
    
@userunknown I do search where the data is stored –  student Mar 29 '12 at 18:28
add comment

2 Answers

If the database servers are running, ask them:

psql -l

mysql <<< 'show databases'

Just searching the filesystem for relational databases is not a trivial task.

share|improve this answer
    
+1 Considering that some relational databases may not even use an FS. :) –  Karlson Mar 29 '12 at 14:58
    
Thanks, but actually I want to know how to search the FS for relational databases. –  student Mar 29 '12 at 15:12
add comment

On my system, the files for postgresql 8.4 are installed in:

 sudo ls -l /etc/postgresql/8.4/main/pgdata/base/
 sudo ls -l /var/lib/postgresql/8.4/main/base

where /etc contains a symbolic link to /var/lib.

You need sudo permissions to watch these directories.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.