初始化环境时出现Access Denied for user

我的docker-compose.yml 文件如下:

version: '2.0'
services:
  db:
    image: mariadb:10.5
    container_name: seatable-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysql_root  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /home/seatable/mysql-data:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    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:latest
    container_name: seatable
    ports:
      - "81:81"
      - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /home/seatable/seatable-data:/shared  # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=mysql_root  # Requested, the value shuold be root's password of MySQL service.
      - SEATABLE_SERVER_LETSENCRYPT=False # Default is False. Whether to use let's encrypt certificate.
      - SEATABLE_SERVER_HOSTNAME=192.111.25.160 # Specifies your host name.
      - TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.
    depends_on:
      - db
      - memcached
      - redis
    networks:
      - seatable-net

networks:
  seatable-net:

执行:

sudo docker-compose up -d
sudo docker exec -d seatable /shared/seatable/scripts/seatable.sh start

均成功。

但,执行:

sudo docker exec -it seatable /shared/seatable/scripts/seatable.sh superuser  

这个命令时,报错如下:

Traceback (most recent call last):
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 189, in connect
self.connection = self.get_new_connection(conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 274, in get_new_connection
conn = Database.connect(**conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 353, in init
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, “Access denied for user ‘root’@‘192.111.25.160’ (using password: YES)”)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/init.py”, line 364, in execute_from_command_line
utility.execute()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/init.py”, line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 283, in run_from_argv
self.execute(*args, **cmd_options)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 327, in execute
self.check()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 359, in check
include_deployment_checks=include_deployment_checks,
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 346, in _run_checks
return checks.run_checks(**kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/checks/registry.py”, line 81, in run_checks
new_errors = check(app_configs=app_configs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/checks/model_checks.py”, line 30, in check_all_models
errors.extend(model.check(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/base.py”, line 1284, in check
errors.extend(cls._check_fields(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/base.py”, line 1359, in _check_fields
errors.extend(field.check(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 913, in check
errors = super(AutoField, self).check(**kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 219, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 322, in _check_backend_specific_checks
return connections[db].validation.check_field(self, **kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/validation.py”, line 49, in check_field
field_type = field.db_type(self.connection)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 644, in db_type
return connection.data_types[self.get_internal_type()] % data
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 174, in data_types
if self.features.supports_microsecond_precision:
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/features.py”, line 53, in supports_microsecond_precision
return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 385, in mysql_version
with self.temporary_connection() as cursor:
File “/usr/lib/python3.7/contextlib.py”, line 112, in enter
return next(self.gen)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 591, in temporary_connection
cursor = self.cursor()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 254, in cursor
return self._cursor()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 229, in _cursor
self.ensure_connection()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/utils.py”, line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/six.py”, line 685, in reraise
raise value.with_traceback(tb)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 189, in connect
self.connection = self.get_new_connection(conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 274, in get_new_connection
conn = Database.connect(**conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 353, in init
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.OperationalError: (1045, “Access denied for user ‘root’@‘192.111.25.160’ (using password: YES)”)

我已确认docker中将mysql的密码时正确的,也进行了远程授权:

grant all privileges on *.* to root@'%' identified by 'mysql_root';

不知我还遗漏什么, 请大神们赐教,谢谢。

1 个赞

数据库是不需要特殊设置的。你可以把配置目录删了,重新配置一遍。

全部重新删除后, 重新安装,这个时候可以进到输入邮箱和密码环节,但是服务起不来,日志报错和redis有关。

[2021-04-29 10:58:50,758] [ERROR] redis pubsub failed. Error 111 connecting to redis:6379. Connection refused. retry after 10s
[2021-04-29 10:59:10,530] [INFO] Starting handle table activities…
[2021-04-29 10:59:10,536] [INFO] Starting count user activity…
[2021-04-29 10:59:10,547] [INFO] Starting handle table rows count…
[2021-04-29 10:59:10,548] [INFO] Starting handle webhook jobs…
[2021-04-29 10:59:10,647] [WARNING] Can not start instant notice sender: it is not enabled!
[2021-04-29 10:59:10,647] [INFO] Start email notices sender, interval = 1800 sec
[2021-04-29 10:59:10,665] [INFO] Start dtables cleaner, interval = 86400 sec
[2021-04-29 10:59:10,675] [INFO] Start dtable updates sender, interval = 3600 sec
[2021-04-29 10:59:10,722] [INFO] Start dtable notification rules scanner
[2021-04-29 10:59:10,741] [WARNING] LDAP syncer not enabled
[2021-04-29 10:59:11,183] [INFO] Adding job tentatively – it will be properly scheduled when the scheduler starts
[2021-04-29 10:59:11,184] [INFO] Added job “DTableNofiticationRulesScannerTimer.run..timed_job” to job store “default”
[2021-04-29 10:59:11,184] [INFO] Scheduler started
[2021-04-29 11:00:00,002] [INFO] Running job “DTableNofiticationRulesScannerTimer.run..timed_job (trigger: cron[day_of_week=‘‘, hour=’’], next run at: 2021-04-29 11:00:00 CST)” (scheduled at 2021-04-29 11:00:00+08:00)
[2021-04-29 11:00:00,002] [INFO] Starts to scan notification rules…
[2021-04-29 11:00:00,011] [INFO] Job “DTableNofiticationRulesScannerTimer.run..timed_job (trigger: cron[day_of_week=‘‘, hour=’’], next run at: 2021-04-29 12:00:00 CST)” executed successfully

请问和我机器版本有关吗?

➜ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
➜ uname -a
Linux kditatap003l 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

我自己最后找出原因了。在配置文件中,由于80端口被占用, 我改成5001端口,好像会出莫名其妙的问题。
我后面端口改为80就好了。