Docker Seafile CE 12 = MySQL access denied

Hi,

I’ve just upgraded Seafile from v11.0.13 to v12.0.11 and immediately after the upgrade I get this warning when launching the new container :

Starting seahub at port 8000 ...

Error happened during creating seafile admin.

Seahub is started

Done.

Then when I check seafile.log :

[2025-04-22 12:41:32] [WARNING] ../common/seaf-db.c(867): Failed to connect to MySQL: Access denied for user 'seafile'@'XX.XX.XX.XX' (using password: YES)

Obviously I can’t log into the webui.

I’m using an external (non-dockerized) MariaDB server and nothing has changed on that side. I can also install mysql-client inside the seafile container and I’m able to log into mariadb.

What changed in v12 which could have caused this issue ?

Hello @cefinformatique1 ,

seafile 12 supports configuring MySQL through environment variables. You can check whether the MySQL-related environment variables in the .env file are consistent with those in seafile.conf.

For upgrade documentation, please refer: Upgrade notes for 12.0.x - Seafile Admin Manual

Hi,

In my case I use the docker-compose.yml from the documentation here : https://manual.seafile.com/12.0/repo/docker/ce/seafile-server.yml which doesn’t contain all of these variables.

I did some more tests and I’m using this docker-compose.yml file currently :

services:
  memcached:
    image: memcached:1.6.29
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:12.0.11
    container_name: seafile
    ports:
      - "80:80"
      - "443:443"
    environment:
      - DB_HOST=XXX
      - DB_PORT=3306
      - DB_USER=seafile
      - DB_ROOT_PASSWD=XXX
      - DB_PASSWORD=XXX
      - SEAFILE_MYSQL_DB_HOST=XXX
      - SEAFILE_MYSQL_DB_PORT=3306
      - SEAFILE_MYSQL_DB_USER=seafile
      - SEAFILE_MYSQL_DB_PASSWORD=XXX
      - SEAFILE_MYSQL_DB_CCNET_DB_NAME=ccnet_db
      - SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=seafile_db
      - SEAFILE_MYSQL_DB_SEAHUB_DB_NAME=seahub_db
      - TIME_ZONE=Europe/Paris
      - INIT_SEAFILE_ADMIN_EMAIL=me@example.com
      - INIT_SEAFILE_ADMIN_PASSWORD=XXX
      - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com
      - SEAFILE_SERVER_PROTOCOL=https
      - SITE_ROOT=/
      - NON_ROOT=false
      - JWT_PRIVATE_KEY=XXX
      - SEAFILE_LOG_TO_STDOUT=false
      - ENABLE_SEADOC=false
    networks:
      - seafile-net

networks:
  seafile-net:
    name: seafile-net

I decided to delete all seafile related databases from my MariaDB server and the seafile user as well in the intent of letting the install script create the seafile user.

Both the databases and the user are created on first launch but I immediately get this error :

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-12.0.11/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-12.0.11/seahub/seahub/base/management/commands/createsuperuser.py", line 88, in handle
    User.objects.get(email=default_username)
  File "/opt/seafile/seafile-server-12.0.11/seahub/seahub/base/accounts.py", line 256, in get
    emailuser = ccnet_threaded_rpc.get_emailuser(email)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-12.0.11/seafile/lib/python3/site-packages/pysearpc/client.py", line 127, in newfunc
    return fret(ret_str)
           ^^^^^^^^^^^^^
  File "/opt/seafile/seafile-server-12.0.11/seafile/lib/python3/site-packages/pysearpc/client.py", line 65, in _fret_obj
    raise SearpcError(dicts['err_msg'])
pysearpc.common.SearpcError: Database error

Here are the logs on startup :

docker-compose up
Creating seafile           ... done
Creating seafile-memcached ... done
Attaching to seafile-memcached, seafile
seafile      | *** Running /etc/my_init.d/01_create_data_links.sh...
seafile      | *** Booting runit daemon...
seafile      | *** Runit started as PID 16
seafile      | *** Running /scripts/enterpoint.sh...
seafile      | 2025-04-23 10:21:02 Nginx ready 
seafile      | 2025-04-23 10:21:02 This is an idle script (infinite loop) to keep container running. 
seafile      | [2025-04-23 10:21:02] Now running setup-seafile-mysql.py in auto mode.
seafile      | Checking python on this machine ...
seafile      | 
seafile      | 
seafile      | verifying password of user root ...  done
seafile      | 
seafile      | ---------------------------------
seafile      | This is your configuration
seafile      | ---------------------------------
seafile      | 
seafile      |     server name:            seafile
seafile      |     server ip/domain:       seafile.mydomain.com
seafile      | 
seafile      |     seafile data dir:       /opt/seafile/seafile-data
seafile      |     fileserver port:        8082
seafile      | 
seafile      |     database:               create new
seafile      |     ccnet database:         ccnet_db
seafile      |     seafile database:       seafile_db
seafile      |     seahub database:        seahub_db
seafile      |     database user:          seafile
seafile      | 
seafile      | 
seafile      | Generating seafile configuration ...
seafile      | 
seafile      | done
seafile      | Generating seahub configuration ...
seafile      | 
seafile      | ----------------------------------------
seafile      | Now creating seafevents database tables ...
seafile      | 
seafile      | ----------------------------------------
seafile      | ----------------------------------------
seafile      | Now creating ccnet database tables ...
seafile      | 
seafile      | ----------------------------------------
seafile      | ----------------------------------------
seafile      | Now creating seafile database tables ...
seafile      | 
seafile      | ----------------------------------------
seafile      | ----------------------------------------
seafile      | Now creating seahub database tables ...
seafile      | 
seafile      | ----------------------------------------
seafile      | 
seafile      | creating seafile-server-latest symbolic link ...  done
seafile      | 
seafile      | 
seafile      | 
seafile      | 
seafile      | -----------------------------------------------------------------
seafile      | Your seafile server configuration has been finished successfully.
seafile      | -----------------------------------------------------------------
seafile      | 
seafile      | run seafile server:     ./seafile.sh { start | stop | restart }
seafile      | run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> }
seafile      | 
seafile      | -----------------------------------------------------------------
seafile      | If you are behind a firewall, remember to allow input/output of these tcp ports:
seafile      | -----------------------------------------------------------------
seafile      | 
seafile      | port of seafile fileserver:   8082
seafile      | port of seahub:               8000
seafile      | 
seafile      | When problems occur, Refer to
seafile      | 
seafile      |         https://download.seafile.com/published/seafile-manual/home.md
seafile      | 
seafile      | for information.
seafile      | 
seafile      | 
seafile      | [2025-04-23 10:21:07] Updating version stamp
seafile      | 
seafile      | Starting seafile server, please wait ...
seafile      | Seafile server started
seafile      | 
seafile      | Done.
seafile      | 
seafile      | Starting seahub at port 8000 ...
seafile      | 
seafile      | Error happened during creating seafile admin.
seafile      | 
seafile      | 
seafile      | Seahub is started
seafile      | 
seafile      | Done.
seafile      | 

Hello @cefinformatique1 ,

this error should be the same as the one above. You can check the MySQL environment variable configuration in the Seafile container by using export , and then try accessing the ccnet_db database with mysql client.

The “MySQL access denied” error is usually caused by incorrect MySQL username/password or lack of permissions to access the corresponding database.

I think I’ve identified the issue.

The deployment works when I’m not using any special character in the DB user password.

Is there a restriction which forces us to only use alphanumerical characters for DB passwords ?

Hi,

There’s generally no restriction on this. What special characters are you using?

I tested with é and à.

Hi,

I tried using the password SEAFILE_MYSQL_DB_PASSWORD="PASSWORDàé", but I couldn’t reproduce the issue. After you set the environment variable, is the password you see inside the Seafile container the same as the one you set?

You can run the following command inside the container to get the environment variable:

export | grep SEAFILE_MYSQL_DB_PASSWORD

Yes it’s present inside the container and the same as the one I set.