Hi,
I have lost my database credentials. Is there a way to retrieve or reset the password ?
Thanks for your help
Hi,
I have lost my database credentials. Is there a way to retrieve or reset the password ?
Thanks for your help
If you fly postgres attach
, it will add a DATABASE_URL
to your server that you can use to retrieve the password
➜ shopify git:(main) ✗ fly postgres attach --help
Attach a postgres cluster to an app
Usage:
flyctl postgres attach [flags]
Flags:
-a, --app string App name to operate on
-c, --config string Path to an app config file or directory containing one (default "./fly.toml")
--database-name string database to use, defaults to a new database with the same name as the app
--database-user string the database user to create, defaults to creating a user with the same name as the consuming app
-h, --help help for attach
--postgres-app string the postgres cluster to attach to the app
--variable-name string the env variable name that will be added to the app. Defaults to DATABASE_URL
Global Flags:
-t, --access-token string Fly API Access Token
-j, --json json output
--verbose verbose output
Hello @Claudio! If you have an app deployed, you can fly ssh console
and then run
echo $DATABASE_URL
And it will print it out. It is this ENV variable that is set when you attach a DB.
Hope that helps!
With the latest postgres fly ssh console
and echo $OPERATOR_PASSWORD
did the trick for me.
thanks for this command
Seems for OPERATOR_PASSWORD
(which you need for -U postgres
, lets say during the proxy + pg_dump) you need add the -a parameter for postgres application: fly ssh console -a <myapp>-db
something that wasn’t clear from the docs is the DB name. The DB name is the app name with underscores instead of dashes.
So if your appname is big-sun-123-db
then the postgres db will be big_sun_123
.
Had to use fly postgres connect -a app-name-db
to start a psql session and then use \c <TAB>
to find out.