When I open a web page on centos and log in to redash, it always shows incorrect username or password, but my password and username are correct


Is it necessary to configure the mail in docker-compose.yml and how should I do it

Ahhh. With the setup.sh script for CentOS, it creates the PostgreSQL database in /opt/redash/postgres-data on the host computer, then passes that directory through to the PostgreSQL Docker container to use.

When someone runs setup.sh for the first time, the database is created in that directory, and Redash adds the tables/fields/etc needed for it to run.

If that person then removes the Docker container and runs setup.sh again, thinking they’re setting up a “fresh” new environment… they can be caught out because the PostgreSQL database isn’t wiped. It’s on the host filesystem in that directory.

The way to “wipe” the installation is to kill the Docker containers and remove that above directory.

Otherwise the setup piece for the database will see the existing data, and assume that is supposed to be kept.

So when the person goes to log into the “newly set up system” it’s actually using the data from the previous run.

Kind of thinking that might be what happened here, but really that’s just a guess. It might be something different. :wink:

If you need to reset the username/password combination anyway, you can do it like this:

1. Get the list of running docker containers

$ cd /opt/redash/
$ docker-compose ps
          Name                         Command               State              Ports           
------------------------------------------------------------------------------------------------
redash_adhoc_worker_1       /app/bin/docker-entrypoint ...   Up      5000/tcp                   
redash_nginx_1              nginx -g daemon off;             Up      443/tcp, 0.0.0.0:80->80/tcp
redash_postgres_1           docker-entrypoint.sh postgres    Up      5432/tcp                   
redash_redis_1              docker-entrypoint.sh redis ...   Up      6379/tcp                   
redash_scheduled_worker_1   /app/bin/docker-entrypoint ...   Up      5000/tcp                   
redash_scheduler_1          /app/bin/docker-entrypoint ...   Up      5000/tcp                   
redash_server_1             /app/bin/docker-entrypoint ...   Up      0.0.0.0:5000->5000/tcp

Make sure the PostgreSQL one is in there. On my system, it’s the redash_postgres_1 line in the above list.

2. Log in to the PostgreSQL database on that container

Use the docker exec command to connect to the PostgreSQL container, and start the “psql” command line interface to the database:

$ docker exec -it redash_postgres_1 su - postgres -c psql postgres
psql (9.5.16)
Type "help" for help.

postgres=#

3. Get the existing user list

From that psql command line prompt, you can run SQL commands against the Redash database. This will show the existing list of users:

postgres=# SELECT id, name, email, password_hash FROM users;
 id | name |      email       |                                                      password_hash                                                       
----+------+------------------+--------------------------------------------------------------------------------------------------------------------------
  1 | jc   | test@example.org | $6$rounds=109264$vL9Dnky2Btg.mNLM$vBH/vL8wCV8EgdMWOzeld3W6HLFtrgC11B.K71ffLra6eJvIUKjBpa4UkneMArH.VuY6VARFzK2pAJSyzhQS40
(1 row)

The $6$rounds ... value there is the hashed value for the password abc123. If you have a user showing up in your system, and don’t remember the password, you can use that above value to reset it to abc123.

4. Reset the password to a known value

To set the password to abc123, use this:

UPDATE users SET password_hash = '$6$rounds=109264$vL9Dnky2Btg.mNLM$vBH/vL8wCV8EgdMWOzeld3W6HLFtrgC11B.K71ffLra6eJvIUKjBpa4UkneMArH.VuY6VARFzK2pAJSyzhQS40' WHERE name = 'jc';

Obviously, the username in that line will need changing from jc to the user in question for that to work. :wink:

If your Redash setup doesn’t yet have any users created… I’d probably just wipe the docker containers and the PostgreSQL directory instead, then set it up from the start using setup.sh again.

Hopefully some of the above helps. :smile:

Ok, thank you. I’ll have a try. I misunderstood the email password for the login of the website. I thought it was the email and password registered on redash’s official website

Cool, good luck. :smile: