On database update: Access denied for user root

I’m trying to upgrade self-hosted Enterprise Edition from 3.2 to the latest 3.3. This is the first time this installation is upgraded. After pulling the version from docker and docker-compose down and docker-compose up -d and logging into the container I want to issue the database update command:
mysql -h$DB_HOST -p$DB_ROOT_PASSWD dtable_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/3.3/dtable.sql

I’m receiving the following error:

root@248c5206b14e:/opt/seatable# mysql -h$DB_HOST -p$DB_ROOT_PASSWD dtable_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/3.3/dtable.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'172.19.0.5' (using password: YES)

I cannot see any mistake in the commands :thinking: I upgraded another installation (Developer Edition) many time using the same commands following the upgrade manual and never ran into this problem.

What might I be doing wrong here?

Thanks for your help!

Edit Update: I did also check if the PW and DB are set correctly by calling echo $DB_ROOT_PASSWD and echo $DB_HOST from within the container. The correct PW is shown. For the DB_HOST it returns db - which should also be correct.

Access the seatable-mysql container using
docker exec -it seatable-mysql bash

Try to connect to mysql
mysql -uroot -p

Enter the password. If this does not work, your password is not correct.

This gives the same error message after entering the password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

But I’m not sure why the password wouldn’t be correct. With the command from the upgrade manual mysql -h$DB_HOST -p$DB_ROOT_PASSWD dtable_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/3.3/dtable.sql I suppose the PW is pulled from the docker-compose.yml. And there I quadruple checked. The PW for both MYSQL_ROOT_PASSWORD and DB_ROOT_PASSWD is set to the same value. Also the same that the command echo $DB_ROOT_PASSWD shows when executed from within the container.

Here’s my docker-compose.yml:

version: '2.0'
services:
  db:
    image: mariadb:10.5
    container_name: seatable-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=MySecretPassword
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /opt/seatable/mysql-data:/var/lib/mysql         # Volume of MySQL (directory for persistent storage) and mount point in container -- can be changed (not advised)
    networks:
      - seatable-net

  memcached:
    image: memcached:1.5.6
    container_name: seatable-memcached
    entrypoint: memcached -m 256
    networks:
      - seatable-net

  redis:
    image: redis:5.0.7
    container_name: seatable-redis
    networks:
      - seatable-net

  seatable:
    image: seatable/seatable-enterprise:latest
    container_name: seatable
    ports:
      - "80:80"                                         # HTTP port on the Docker host and the port in the container -- must be changed if port 80 is already in use on Docker host
      - "443:443"                                       # HTTPS port on the Docker host and the port in the container -- must be changed if port 443 is already in use on Docker host
    volumes:
      - /opt/seatable/seatable-data:/shared             # Volume of SeaTable (directory for persistent storage) and mount point in container -- can be changed (not advised)
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=MySecretPassword
      - SEATABLE_SERVER_LETSENCRYPT=True               # Decision on whether or not to use Let's Encrypt for HTTPS, default is False -- must be changed to True if a Let's Encrypt SSL certificate is to be used
      - SEATABLE_SERVER_HOSTNAME=seatable.mydomain.com   # Host name -- must be changed
      - TIME_ZONE=Etc/UTC                               # Optional, default is UTC. Example: Europe/Berlin. Choices can be found here: http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
    depends_on:
      - db
      - memcached
      - redis
    networks:
      - seatable-net

networks:
  seatable-net:

Or is there some other place where the PW could be set incorrectly?

I guess you modified the mysql password in the Compose file after your initial docker-compose up . Is that so?

After the initialization of the database, you can modify the MYSQL_ROOT_PASSWORD and the DB_ROOT_PASSWD in the docker-compose.yml, but it won’t have any effect. The DB password is written in the config file during initialization.

Where to get the DB password? Go to /opt/seatable/seatable-data/seatable/conf and open the conf file ccnet.conf. There you will find the db password that SeaTable uses to connect to the database.

1 Like

Yup, that was the problem. The database is still using the default password and not the one from docker-compse.yml. Obviously I must have tried to change it after the initial docker-compose up.

Can I change the PW by simply entering a new one in ccnet.conf and then fill the same one in docker-compose.yml of will this break things again?

Nope! This will not work!

To change your mysql password, you must change the root password in mysql first. Here’s a tut. Then you must replace the old password with the new one in all conf files in /opt/seatable/seatable-data/seatable/conf. It’s not just ccnet.conf!

As I said in my previous post, the password in the docker-compose.yml is of no relevance any more after the initial docker-compose up. Whether or not you update the db password in this file is thus totally up to you.

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