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

  • 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

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.

  • +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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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