Skip to content

【Bug问题】: mySQL无法完成初始化 #517

@wuyilingwei

Description

@wuyilingwei

docker镜像版本

2.6.0

MusicTagWeb 版本

V2

bug 描述

遵循官网建议的mySQL模式:https://xiers-organization.gitbook.io/music-tag-web-v2/jin-jie-pei-zhi/mysql-bu-shu

  1. 但是遇到无法启动主进程
    music-tag-web | 2025-10-31 05:54:56,623 INFO spawned: 'gunicorn' with pid 40
    music-tag-web | 2025-10-31 05:54:58,615 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

  2. 经过查询日志,Django 在执行迁移 script_mgmt.0006_auto_20250921_1748 时,试图删除索引 script_mgmt_plugin__c9c055_idx,但该索引正被某个外键约束依赖,于是抛错:

OperationalError: (1553, "Cannot drop index 'script_mgmt_plugin__c9c055_idx': needed in a foreign key constraint")

这会让 manage.py migrate 失败,进而让 gunicorn 不断退出重启。

  1. 手动删除后重试,下一个错误是迁移在 post_migrate 阶段触发了 applications/task/handlers.init_task,而此时表 user_userprofile 还不存在,所以抛了:

django.db.utils.ProgrammingError: (1146, "Table 'music_tag.user_userprofile' doesn't exist")

这通常意味着 user 应用(或你项目里自定义的用户/用户资料 app)还没建表,但别的 app 的 post_migrate 回调已经在访问它了。解决思路是:先把依赖的基础 app 和 user 相关表迁起来,再跑全量迁移。

  1. 然后根据ai的建议删掉后重新跑了初始化,终于跑通了
    docker compose run --rm --no-deps music-tag python manage.py showmigrations
    docker compose run --rm --no-deps music-tag python manage.py migrate contenttypes --fake-initial
    docker compose run --rm --no-deps music-tag python manage.py migrate auth --fake-initial
    docker compose run --rm --no-deps music-tag python manage.py migrate sessions --fake-initial

  2. 现在的问题是我注意到创建新用户(给家人和朋友用)是自带全部管理权限的,即使在admin中没有给任何特权,/#/system中也设置为听众席位,但是仍然有管理权限,除了gui默认不显示以外可以正常访问/#/system的所有管理内容并保存修改,无法登录/admin。不确定是安全设计是这样的,还是说因为修改过数据库导致的。

附配置:
docker compose up

services:
  # MySQL 数据库服务
  db:
    image: mysql:5.7 #(latest也试过,不行)
    container_name: mysql
    ports:
      - "127.0.0.1:8003:3306"
    restart: always
    command:  #使用 command 可以覆盖容器启动后默认执行的命令
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: 匿了  # 修改为你的 MySQL 密码
      MYSQL_DATABASE: music_tag  # 数据库名称,无需修改
    volumes:
      - ./mysql-data:/var/lib/mysql  # 数据持久化存储目录
      - ./mysql-backups:/backups  # 备份目录

  # Music Tag Web 服务
  music-tag:
    image: xhongc/music_tag_web:latest
    container_name: music-tag-web
    ports:
      - "127.0.0.1:8002:8002"  # 主机端口:容器端口
    volumes:
      - ./web/media:/app/media  # 修改为你的音乐文件目录
      - ./web/data:/app/data  # 修改为你的配置文件存储目录
    environment:
      - MYSQL_HOST=db  # 数据库主机名,使用服务名, 不需要修改
      - MYSQL_PASSWORD=匿了  # 与上面的 MySQL 密码一致
      - MYSQL_DB_NAME=music_tag  # 数据库名称,无需修改
      - MYSQL_USER=root  # MySQL 用户名,无需修改
      - MYSQL_PORT=3306  # MySQL 端口,无需修改
      - WORKER_NUM=8  # 后台任务工作线程数,可根据服务器性能调整
    restart: always
    depends_on:
      - db  # 依赖于 MySQL 服务

系统日志(可填)

docker 初始化
root@ubuntu:/home/music-tag# docker compose up
WARN[0000] /home/music-tag/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 3/3
 ✔ Network music-tag_default  Created                                                                                                                                                0.0s 
 ✔ Container mysql            Created                                                                                                                                                0.0s 
 ✔ Container music-tag-web    Created                                                                                                                                                0.0s 
Attaching to music-tag-web, mysql
mysql  | 2025-10-31 05:54:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
music-tag-web  | Skipping creation of musictag user because PUID or PGID is set to 0.
mysql          | 2025-10-31 05:54:42+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql          | 2025-10-31 05:54:42+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
music-tag-web  | 2025-10-31 05:54:42,272 INFO Set uid to user 0 succeeded
music-tag-web  | 2025-10-31 05:54:42,278 INFO RPC interface 'supervisor' initialized
music-tag-web  | 2025-10-31 05:54:42,279 INFO RPC interface 'supervisor' initialized
music-tag-web  | 2025-10-31 05:54:42,279 CRIT Server 'unix_http_server' running without any HTTP authentication checking
music-tag-web  | 2025-10-31 05:54:42,279 INFO supervisord started with pid 1
mysql          | 2025-10-31 05:54:42+00:00 [Note] [Entrypoint]: Initializing database files
mysql          | 2025-10-31T05:54:42.427241Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql          | 2025-10-31T05:54:42.617983Z 0 [Warning] InnoDB: New log files created, LSN=45790
mysql          | 2025-10-31T05:54:42.652886Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
mysql          | 2025-10-31T05:54:42.657470Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 189b0efe-b61e-11f0-b5b1-ae28b3ea1812.
mysql          | 2025-10-31T05:54:42.659315Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
mysql          | 2025-10-31T05:54:42.754434Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:42.754453Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:42.754895Z 0 [Warning] CA certificate ca.pem is self signed.
mysql          | 2025-10-31T05:54:42.796027Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
music-tag-web  | 2025-10-31 05:54:43,282 INFO spawned: 'gunicorn' with pid 6
music-tag-web  | 2025-10-31 05:54:43,284 INFO spawned: 'nginx' with pid 7
music-tag-web  | 2025-10-31 05:54:43,286 INFO spawned: 'redis' with pid 8
music-tag-web  | 2025-10-31 05:54:43,288 INFO spawned: 'worker' with pid 10
music-tag-web  | 2025-10-31 05:54:43,292 INFO spawned: 'beat' with pid 12
music-tag-web  | 2025-10-31 05:54:44,441 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:44,441 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:44,441 INFO success: worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:44,441 INFO success: beat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
mysql          | 2025-10-31 05:54:44+00:00 [Note] [Entrypoint]: Database files initialized
mysql          | 2025-10-31 05:54:44+00:00 [Note] [Entrypoint]: Starting temporary server
mysql          | 2025-10-31 05:54:44+00:00 [Note] [Entrypoint]: Waiting for server startup
mysql          | 2025-10-31T05:54:44.766072Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql          | 2025-10-31T05:54:44.768712Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 126 ...
mysql          | 2025-10-31T05:54:44.773586Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql          | 2025-10-31T05:54:44.773613Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql          | 2025-10-31T05:54:44.773618Z 0 [Note] InnoDB: Uses event mutexes
mysql          | 2025-10-31T05:54:44.773622Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql          | 2025-10-31T05:54:44.773626Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
mysql          | 2025-10-31T05:54:44.773630Z 0 [Note] InnoDB: Using Linux native AIO
mysql          | 2025-10-31T05:54:44.773968Z 0 [Note] InnoDB: Number of pools: 1
mysql          | 2025-10-31T05:54:44.774115Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql          | 2025-10-31T05:54:44.777073Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql          | 2025-10-31T05:54:44.789718Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql          | 2025-10-31T05:54:44.793229Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql          | 2025-10-31T05:54:44.805627Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql          | 2025-10-31T05:54:44.818100Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql          | 2025-10-31T05:54:44.818463Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql          | 2025-10-31T05:54:44.850035Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql          | 2025-10-31T05:54:44.851703Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql          | 2025-10-31T05:54:44.851719Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql          | 2025-10-31T05:54:44.852685Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 2768291
mysql          | 2025-10-31T05:54:44.853250Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql          | 2025-10-31T05:54:44.853466Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql          | 2025-10-31T05:54:44.855620Z 0 [Note] InnoDB: Buffer pool(s) load completed at 251031  5:54:44
mysql          | 2025-10-31T05:54:44.864340Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql          | 2025-10-31T05:54:44.864530Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql          | 2025-10-31T05:54:44.864659Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:44.864827Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:44.865681Z 0 [Warning] CA certificate ca.pem is self signed.
mysql          | 2025-10-31T05:54:44.865732Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql          | 2025-10-31T05:54:44.872158Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql          | 2025-10-31T05:54:44.880676Z 0 [Note] Event Scheduler: Loaded 0 events
mysql          | 2025-10-31T05:54:44.881668Z 0 [Note] mysqld: ready for connections.
mysql          | Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
mysql          | 2025-10-31 05:54:45+00:00 [Note] [Entrypoint]: Temporary server started.
mysql          | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
mysql          | 2025-10-31T05:54:45.592142Z 3 [Note] InnoDB: Stopping purge
mysql          | 2025-10-31T05:54:45.597108Z 3 [Note] InnoDB: Resuming purge
mysql          | 2025-10-31T05:54:45.598939Z 3 [Note] InnoDB: Stopping purge
mysql          | 2025-10-31T05:54:45.603018Z 3 [Note] InnoDB: Resuming purge
mysql          | 2025-10-31T05:54:45.606709Z 3 [Note] InnoDB: Stopping purge
mysql          | 2025-10-31T05:54:45.609440Z 3 [Note] InnoDB: Resuming purge
mysql          | 2025-10-31T05:54:45.613628Z 3 [Note] InnoDB: Stopping purge
mysql          | 2025-10-31T05:54:45.617043Z 3 [Note] InnoDB: Resuming purge
mysql          | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
mysql          | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
music-tag-web  | 2025-10-31 05:54:46,298 INFO exited: beat (exit status 1; not expected)
music-tag-web  | 2025-10-31 05:54:46,300 INFO spawned: 'beat' with pid 28
music-tag-web  | 2025-10-31 05:54:46,754 INFO exited: gunicorn (exit status 1; not expected)
mysql          | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
mysql          | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
mysql          | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
mysql          | 2025-10-31 05:54:46+00:00 [Note] [Entrypoint]: Creating database music_tag
mysql          | 
mysql          | 2025-10-31 05:54:46+00:00 [Note] [Entrypoint]: Stopping temporary server
mysql          | 2025-10-31T05:54:46.863580Z 0 [Note] Giving 0 client threads a chance to die gracefully
mysql          | 2025-10-31T05:54:46.863604Z 0 [Note] Shutting down slave threads
mysql          | 2025-10-31T05:54:46.863608Z 0 [Note] Forcefully disconnecting 0 remaining clients
mysql          | 2025-10-31T05:54:46.863612Z 0 [Note] Event Scheduler: Purging the queue. 0 events
mysql          | 2025-10-31T05:54:46.863663Z 0 [Note] Binlog end
mysql          | 2025-10-31T05:54:46.864180Z 0 [Note] Shutting down plugin 'ngram'
mysql          | 2025-10-31T05:54:46.864192Z 0 [Note] Shutting down plugin 'partition'
mysql          | 2025-10-31T05:54:46.864195Z 0 [Note] Shutting down plugin 'BLACKHOLE'
mysql          | 2025-10-31T05:54:46.864198Z 0 [Note] Shutting down plugin 'ARCHIVE'
mysql          | 2025-10-31T05:54:46.864199Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
mysql          | 2025-10-31T05:54:46.864328Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
mysql          | 2025-10-31T05:54:46.864346Z 0 [Note] Shutting down plugin 'MyISAM'
mysql          | 2025-10-31T05:54:46.864363Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
mysql          | 2025-10-31T05:54:46.864377Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
mysql          | 2025-10-31T05:54:46.864390Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
mysql          | 2025-10-31T05:54:46.864403Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
mysql          | 2025-10-31T05:54:46.864416Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
mysql          | 2025-10-31T05:54:46.864420Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
mysql          | 2025-10-31T05:54:46.864421Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
mysql          | 2025-10-31T05:54:46.864423Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
mysql          | 2025-10-31T05:54:46.864425Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
mysql          | 2025-10-31T05:54:46.864426Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
mysql          | 2025-10-31T05:54:46.864428Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
mysql          | 2025-10-31T05:54:46.864429Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
mysql          | 2025-10-31T05:54:46.864431Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
mysql          | 2025-10-31T05:54:46.864433Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
mysql          | 2025-10-31T05:54:46.864434Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
mysql          | 2025-10-31T05:54:46.864436Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
mysql          | 2025-10-31T05:54:46.864437Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
mysql          | 2025-10-31T05:54:46.864439Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
mysql          | 2025-10-31T05:54:46.864441Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
mysql          | 2025-10-31T05:54:46.864442Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
mysql          | 2025-10-31T05:54:46.864444Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
mysql          | 2025-10-31T05:54:46.864446Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
mysql          | 2025-10-31T05:54:46.864447Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
mysql          | 2025-10-31T05:54:46.864449Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
mysql          | 2025-10-31T05:54:46.864451Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
mysql          | 2025-10-31T05:54:46.864452Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
mysql          | 2025-10-31T05:54:46.864454Z 0 [Note] Shutting down plugin 'INNODB_CMP'
mysql          | 2025-10-31T05:54:46.864455Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
mysql          | 2025-10-31T05:54:46.864457Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
mysql          | 2025-10-31T05:54:46.864459Z 0 [Note] Shutting down plugin 'INNODB_TRX'
mysql          | 2025-10-31T05:54:46.864460Z 0 [Note] Shutting down plugin 'InnoDB'
mysql          | 2025-10-31T05:54:46.864513Z 0 [Note] InnoDB: FTS optimize thread exiting.
mysql          | 2025-10-31T05:54:46.864664Z 0 [Note] InnoDB: Starting shutdown...
mysql          | 2025-10-31T05:54:46.964873Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
mysql          | 2025-10-31T05:54:46.965407Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 251031  5:54:46
music-tag-web  | 2025-10-31 05:54:47,172 INFO spawned: 'gunicorn' with pid 30
music-tag-web  | 2025-10-31 05:54:47,406 INFO success: beat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:48,200 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
mysql          | 2025-10-31T05:54:48.675349Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12219253
mysql          | 2025-10-31T05:54:48.679336Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
mysql          | 2025-10-31T05:54:48.679369Z 0 [Note] Shutting down plugin 'MEMORY'
mysql          | 2025-10-31T05:54:48.679375Z 0 [Note] Shutting down plugin 'CSV'
mysql          | 2025-10-31T05:54:48.679380Z 0 [Note] Shutting down plugin 'sha256_password'
mysql          | 2025-10-31T05:54:48.679383Z 0 [Note] Shutting down plugin 'mysql_native_password'
mysql          | 2025-10-31T05:54:48.679535Z 0 [Note] Shutting down plugin 'binlog'
mysql          | 2025-10-31T05:54:48.682559Z 0 [Note] mysqld: Shutdown complete
mysql          | 
mysql          | 2025-10-31 05:54:48+00:00 [Note] [Entrypoint]: Temporary server stopped
mysql          | 
mysql          | 2025-10-31 05:54:48+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
mysql          | 
mysql          | 2025-10-31T05:54:49.073311Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql          | 2025-10-31T05:54:49.075193Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 1 ...
mysql          | 2025-10-31T05:54:49.079079Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql          | 2025-10-31T05:54:49.079123Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql          | 2025-10-31T05:54:49.079127Z 0 [Note] InnoDB: Uses event mutexes
mysql          | 2025-10-31T05:54:49.079130Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql          | 2025-10-31T05:54:49.079135Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
mysql          | 2025-10-31T05:54:49.079137Z 0 [Note] InnoDB: Using Linux native AIO
mysql          | 2025-10-31T05:54:49.079460Z 0 [Note] InnoDB: Number of pools: 1
mysql          | 2025-10-31T05:54:49.079669Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql          | 2025-10-31T05:54:49.082937Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql          | 2025-10-31T05:54:49.093454Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql          | 2025-10-31T05:54:49.095944Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql          | 2025-10-31T05:54:49.108270Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql          | 2025-10-31T05:54:49.116619Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql          | 2025-10-31T05:54:49.116693Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql          | 2025-10-31T05:54:49.134907Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql          | 2025-10-31T05:54:49.135807Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql          | 2025-10-31T05:54:49.135820Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql          | 2025-10-31T05:54:49.136174Z 0 [Note] InnoDB: Waiting for purge to start
music-tag-web  | 2025-10-31 05:54:49,156 INFO exited: beat (exit status 1; not expected)
music-tag-web  | 2025-10-31 05:54:49,162 INFO spawned: 'beat' with pid 36
mysql          | 2025-10-31T05:54:49.186589Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 12219253
mysql          | 2025-10-31T05:54:49.186949Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql          | 2025-10-31T05:54:49.187755Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql          | 2025-10-31T05:54:49.192161Z 0 [Note] InnoDB: Buffer pool(s) load completed at 251031  5:54:49
mysql          | 2025-10-31T05:54:49.196679Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql          | 2025-10-31T05:54:49.196696Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql          | 2025-10-31T05:54:49.196699Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:49.196701Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
mysql          | 2025-10-31T05:54:49.197379Z 0 [Warning] CA certificate ca.pem is self signed.
mysql          | 2025-10-31T05:54:49.197421Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql          | 2025-10-31T05:54:49.199568Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
mysql          | 2025-10-31T05:54:49.199611Z 0 [Note] IPv6 is available.
mysql          | 2025-10-31T05:54:49.200359Z 0 [Note]   - '::' resolves to '::';
mysql          | 2025-10-31T05:54:49.200660Z 0 [Note] Server socket created on IP: '::'.
mysql          | 2025-10-31T05:54:49.205021Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql          | 2025-10-31T05:54:49.213177Z 0 [Note] Event Scheduler: Loaded 0 events
mysql          | 2025-10-31T05:54:49.213759Z 0 [Note] mysqld: ready for connections.
mysql          | Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
music-tag-web  | 2025-10-31 05:54:50,164 INFO success: beat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:53,862 INFO success: redis entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
music-tag-web  | 2025-10-31 05:54:55,620 INFO exited: gunicorn (exit status 1; not expected)
music-tag-web  | 2025-10-31 05:54:56,623 INFO spawned: 'gunicorn' with pid 40
music-tag-web  | 2025-10-31 05:54:58,615 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
music-tag-web  | 2025-10-31 05:55:00,011 INFO exited: gunicorn (exit status 1; not expect


 日志
/app/supervisor.conf:20:[program:gunicorn]
# awk '/\[program:gunicorn\]/{flag=1} flag{print} /^\[/{ if($0 !~ /^\[program:gunicorn\]/ && flag){ exit } }' /app/supervisor.conf
[program:gunicorn]
user  = %(ENV_MY_PROGRAM_USER)s
directory = /app
command = /start
autostart=true
autorestart=unexpected
startretries=3
environment=dockerrun=yes,supervisorRun=yes,GUNICORN_PORT=%(ENV_GUNICORN_PORT)s
stdout_logfile=/app/log/gunicorn.log
stderr_logfile=/app/log/gunicorn_err.log
priority=1
unning migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...程序启动数据库:MySQL
程序启动方式:Supervisor
['manage.py', 'migrate']
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_celery_beat, django_celery_results, music, script_mgmt, sessions, task, user
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748...# 

Traceback (most recent call last):
  File "/app/manage.py", line 24, in <module>
    main()
  File "/app/manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 244, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/operations/models.py", line 815, in database_forwards
    schema_editor.remove_index(model, index)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 389, in remove_index
    self.execute(index.remove_sql(model, self))
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 145, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1553, "Cannot drop index 'script_mgmt_plugin__c9c055_idx': needed in a foreign key constraint")
/usr/local/lib/python3.9/site-packages/gevent/events.py:74: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import iter_entry_points
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1553, "Cannot drop index 'script_mgmt_plugin__c9c055_idx': needed in a foreign key constraint")



mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1091 (42000) at line 1: Can't DROP 'script_mgmt_plugin__c9c055_idx'; check that column/key exists
Error response from daemon: container df91e4ef500264d67da61b81ccdeb180ec88de8aef37d3f86c552137a28cbeef is not running
root@ubuntu:/home/music-tag# docker compose run --rm --no-deps music-tag python manage.py migrate script_mgmt 0006 --fake
Skipping creation of musictag user because PUID or PGID is set to 0.
程序启动数据库:MySQL
程序启动方式:V1部署
/app/applications/script_mgmt/plugins/smart_tag.py:18: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from applications.task.services.smart_tag_resource import SmartTagClient
['manage.py', 'migrate', 'script_mgmt', '0006', '--fake']
Operations to perform:
  Target specific migration: 0006_auto_20250921_1748, from script_mgmt
Running migrations:
  Applying script_mgmt.0006_auto_20250921_1748... FAKED
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1146, "Table 'music_tag.user_userprofile' doesn't exist")

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

Traceback (most recent call last):
  File "/app/manage.py", line 24, in <module>
    main()
  File "/app/manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 268, in handle
    emit_post_migrate_signal(
  File "/usr/local/lib/python3.9/site-packages/django/core/management/sql.py", line 42, in emit_post_migrate_signal
    models.signals.post_migrate.send(
  File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send
    return [
  File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "applications/task/handlers.py", line 30, in applications.task.handlers.init_task
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 581, in get_or_create
    return self.get(**kwargs), False
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 431, in get
    num = len(clone)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 262, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'music_tag.user_userprofile' doesn't exist")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions