Psql password authentication failed

Hi there :wave:

I am trying to import a .sql file into my database I created in the storage tab.

I am running this command in my terminal: pg_dump db.sql | psql "postgres://default:.......... but I am prompted to enter a password.

I have tried the postgres password but this does not work. What password do I need? or is there an issue with my command?

Hi, @byanthony!

From a related discussion in our old platform:

  1. Go to the project dashboard.
  2. Go to the Storage tab.
  3. Click on database
  4. Click on “Connect.”

Vercel will generate a set of PostgreSQL environment variables - the one we’re after here is POSTGRES_PASSWORD. Find its value, copy it, then put the password into psql.

Does that help?

Hi @pawlean :wave: No, this did not help.

This is the error I get when using the POSTGRES_PASSWORD: pg_dump: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "anthony"

And this is the command I am running: pg_dump db.sql | psql "postgres://default:<secret>@ep-green-hat-a41ooa8g.us-east-1.aws.neon.tech:5432/verceldb"

Think the command was not the right one.

Try this one: psql -h ep-green-hat-a41ooa8g-pooler.us-east-1.aws.neon.tech -U default -d verceldb -f db.sql.

Then, I am prompted to enter the Password for user default and enter the POSTGRES_PASSWORD.

The import starts. I still get error as my file seems to have a wrong format. However, think that replies to the original question.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.