求助:挂载MariaDB数据库出现大量报错 [Warning] Aborted connection

如题,小白挂载MariaDB数据库出现大量报错

Version: '10.11.7-MariaDB-1:10.11.7+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2024-03-25 17:52:05 43 [Warning] Aborted connection 43 to db: 'new-api' user: 'root' host: '172.18.0.7' (Got an error reading communication packets)
2024-03-25 17:54:43 44 [Warning] Aborted connection 44 to db: 'new-api' user: 'new-api' host: '8.219.114.34' (Got an error reading communication packets)
2024-03-25 18:06:06 60 [Warning] Access denied for user 'new-api'@'localhost' (using password: NO)
2024-03-25 18:08:11 61 [Warning] Aborted connection 61 to db: 'unconnected' user: 'new-api' host: 'localhost' (Got an error reading communication packets)
2024-03-25 18:14:36 72 [Warning] Aborted connection 72 to db: 'unconnected' user: 'unauthenticated' host: '221.214.220.77' (This connection closed normally without authentication)
2024-03-25 18:14:38 73 [Warning] Aborted connection 73 to db: 'unconnected' user: 'unauthenticated' host: '221.214.220.77' (This connection closed normally without authentication)
2024-03-25 18:14:48 74 [Warning] Aborted connection 74 to db: 'unconnected' user: 'unauthenticated' host: '221.214.220.77' (This connection closed normally without authentication)

new-api的docker compose文件

version: '3.4'

services:
  new-api:
    image: pengzhile/new-api:latest
    container_name: new-api
    restart: always
    command: --log-dir /app/logs
    ports:
      - "3000:3000"
    volumes:
      - ./data/new-api:/data
      - ./logs:/app/logs
    environment:
      - SQL_DSN=new-api:123456@tcp(1Panel-mariadb-gcGc:3306)/new-api  # 修改此行,或注释掉以使用 SQLite 作为数据库
      - REDIS_CONN_STRING=redis://redis
      - SESSION_SECRET=v1LeBiGFn9  # 修改为随机字符串
      - TZ=Asia/Shanghai
#      - NODE_TYPE=slave  # 多机部署时从节点取消注释该行
#      - SYNC_FREQUENCY=60  # 需要定期从数据库加载数据时取消注释该行
#      - FRONTEND_BASE_URL=https://openai.justsong.cn  # 多机部署时从节点取消注释该行

    depends_on:
      - redis

  redis:
    image: redis:latest
    container_name: redis
    restart: always

networks:
  default:
    external:
      name: 1panel-network

1 panel面板中编排的
希望得到佬友们的指点,先感谢!

看日志是尝试了172.地址、8.219、212.214三种地址,均没有权限访问,可以试试把

SQL_DSN=new-api:123456@

修改为:

SQL_DSN=root:123456@

同时也要检查你的mysql设置,是不是这样,以及容器和mysql之间能不能联通。

谢谢,改过root也是一样报错,我去搜搜容器和mysql之间能不能联通。我挂载以后能正常使用但是有时保存成功有时保存延迟特别高,很不稳定

如果是同一台服务器,建议是选一个内网链接,直接写ip稳定一些。

都是1panel-network,然后连接是通过容器:端口的方式