Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following command runs fine, that is, doesn't ask for a password, prints no warnings or errors, and simply provides a DB prompt:

$ psql -U dbuser dbname
psql (8.4.10)
Type "help" for help.


When trying to generate an ERD out of this DB with SchemaSpy (running as the same host user), it doesn't work:

$ java -jar ~/schemaSpy.jar -dp /usr/share/java/postgresql.jar -t pgsql \
-host localhost -db dbname -u dbuser -o ~/db

Using database properties:

Failed to connect to database URL [jdbc:postgresql://localhost/dbname]

org.postgresql.util.PSQLException: The server requested password-based
authentication, but no password was provided.

If I try with a blank password (-p ''), it instead prints:

org.postgresql.util.PSQLException: FATAL: password authentication failed for
user "dbuser"

How do I run SchemaSpy on a PostgreSQL database with a DB user that has no password?

I tried changing the pg_hba.conf settings to completely permissive, but it still doesn't work:

$ sudo grep ^local /etc/postgresql/*/main/pg_hba.conf
local   all         postgres                          ident
local   all         all                               trust
share|improve this question

closed as off topic by Octavian Damiean, jokerdino, htorque, Jorge Castro, Bruno Pereira Feb 13 '12 at 8:33

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This seems quite off topic for Ask Ubuntu. Is your problem related to Ubuntu in any way? – Octavian Damiean Feb 3 '12 at 10:52
psql and libpg-java are Ubuntu packages. – l0b0 Feb 3 '12 at 10:56
Yes, but it isn't really related to Ubuntu in any obvious way. – Octavian Damiean Feb 3 '12 at 11:03
Maybe it should be migrated to SuperUser? I found a lot of references to similar questions on Google before I found a useful answer. – l0b0 Feb 3 '12 at 11:08
Not sure, it could be a good question for Database Administrators. – Octavian Damiean Feb 3 '12 at 11:13

Found the answer related to a similar problem with pgAdmin III: Both programs (unlike psql) establish TCP/IP connections rather than Unix socket connections, so the relevant line in /etc/postgresql/*/main/pg_hba.conf is this one, which will result in a password prompt even if the password is empty.

host    all         all          md5

To fix this, you have to trust connections from localhost, for example with the following line:

host    all         all          trust

and reload the configuration:

sudo service postgresql reload

Now both SchemaSpy and pgAdmin should be able to connect.

share|improve this answer

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