【问题标题】:Mysql container errors, socket creation errosMysql容器错误,socket创建错误
【发布时间】:2021-03-25 14:58:45
【问题描述】:

我正在尝试使用containerd 运行 MySQL 容器;每当我尝试运行它时,它都会引发以下错误?

错误是,套接字设置和创建锁定文件失败。我的主机没有安装 SQL 服务器。

使用来自 docker hub 的官方 MySQL 最新镜像。使用ctr 管理containerd。需要对配置进行哪些更改才能消除此错误?

ctr run  --mount type=bind,src=$PWD,dst=/context,options=rbind:ro --env MYSQL_ROOT_PASSWORD=test123 docker.io/library/mysql:latest sql1
2020-12-08 15:46:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08 15:46:14+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-12-08 15:46:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08 15:46:14+00:00 [Note] [Entrypoint]: Initializing database files
2020-12-08T15:46:14.251822Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2020-12-08T15:46:14.251830Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2020-12-08T15:46:14.252208Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.22) initializing of server in progress as process 44
2020-12-08T15:46:14.259095Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-08T15:46:14.524966Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-08T15:46:15.826735Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-12-08 15:46:19+00:00 [Note] [Entrypoint]: Database files initialized
2020-12-08 15:46:19+00:00 [Note] [Entrypoint]: Starting temporary server
2020-12-08T15:46:19.249242Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2020-12-08T15:46:19.249251Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2020-12-08T15:46:19.491977Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 89
2020-12-08T15:46:19.508069Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-08T15:46:19.674786Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-08T15:46:19.795249Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2020-12-08T15:46:19.795450Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
2020-12-08T15:46:19.955656Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-08T15:46:19.955904Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-08T15:46:19.956779Z 0 [ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2020-12-08T15:46:19.957008Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2020-12-08T15:46:19.957498Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-12-08T15:46:19.957730Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
2020-12-08 15:46:19+00:00 [ERROR] [Entrypoint]: Unable to start server.

【问题讨论】:

    标签: mysql docker containerd


    【解决方案1】:

    /etc/mysql/my.cnfsql_mode = 开头的行上,尝试删除NO_AUTO_CREATE_USER,保存文件并重新启动容器。

    【讨论】:

    • 谢谢,J。我的主机是否需要运行 mysql 才能运行 SQL 容器? MySQL 容器是否使用任何主机 MySQL 套接字/路径来启动容器? /etc/mysql/my.conf 你指的是主机吗?请注意,我的主机没有安装任何 SQL。
    【解决方案2】:

    当我尝试使用 Containerd 启动 mysql 容器时,我遇到了同样的错误。我最终在主机上创建了“/var/run/mysqld/”并挂载它。

    mkdir /var/run/mysqld
    useradd -m mysql
    chown mysql:mysql /var/run/mysqld
    

    在权限更改为 777 之前仍有错误?

    chmod 777 /var/run/mysqld
    
    
    ctr --debug run --mount type=bind,src=/var/run/mysqld,dst=/var/run/mysqld,options=rbind:rw --env MYSQL_DATABASE=testdb --env MYSQL_ROOT_PASSWORD=foo --net-host docker.io/library/mysql:latest mysqldb
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-16
      • 2014-01-24
      • 1970-01-01
      • 2013-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      相关资源
      最近更新 更多