-
Notifications
You must be signed in to change notification settings - Fork 8.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't not change postgress username and password #9888
Comments
To change the PostgreSQL username and password in a self-hosted Dify setup, you need to update the relevant environment variables in the
Make sure to replace Additionally, ensure that the new role (username) you are using actually exists in the PostgreSQL database. If it doesn't, you will need to create it. You can do this by accessing the PostgreSQL container and using SQL commands to create the role. Here's a basic example of how you might do this: CREATE ROLE <new_username> WITH LOGIN PASSWORD '<new_password>'; Replace |
@StudyingLover |
The initial configuration for the PostgreSQL username and password in Dify is set in the DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-difyai123456} Additionally, within the PostgreSQL service configuration: db:
environment:
PGUSER: ${PGUSER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456} These configurations set the default PostgreSQL username to If you want to use your desired username and password, you need to update these environment variables in the |
@dosu Which file is setting the initial postgres user name and password besides the .env file? On fresh install, I simply changed the default DB_USERNAME and DB_PASSWORD, but it does not work! It is showing Internal Server Error! |
Besides the db:
image: postgres:15-alpine
restart: always
environment:
PGUSER: postgres
POSTGRES_PASSWORD: difyai123456
POSTGRES_DB: dify Additionally, the
Changing the default |
@dosu |
The initial PostgreSQL username and password are set in the db:
image: postgres:15-alpine
restart: always
environment:
PGUSER: ${PGUSER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-difyai123456}
POSTGRES_DB: ${POSTGRES_DB:-dify}
PGDATA: ${PGDATA:-/var/lib/postgresql/data/pgdata} The default username is If you are encountering issues with changing these credentials, ensure that you update the environment variables in the |
A fresh install means you need to remove everything in docker/volumns and set the password and username in |
That's exactly what I did. I am fully aware that the user name and password are stored in docker/volumes directory. I removed docker/volumes, dowloaded it from dify repo, placed it back to where it was. I even remove the docker volume by running: docker volume prune -f Then, I restarted the containers with my user name and password. But it still does not work. |
@crazywoola @taowang1993
|
Thank you very much! I fixed the problem. I simply changed PGUSER to POSTGRES_USER in both .env and docker-compose.yaml file. Now, it works perfectly! |
The REDIS_USERNAME is not working either. It should be REDIS_USER instead. |
Self Checks
Dify version
0.10.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
This is a fresh install.
I tried to change:
DB_USERNAME=postgres
DB_PASSWORD=difyai123456
But after I change them and deploy the app, the browser shows:
Internal Server Error
postgres container logs
Do I have to use "postgres" as the user name, and difyai123456 as the password?
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The text was updated successfully, but these errors were encountered: