0

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

错误是,套接字设置和创建锁定文件失败。我的主机没有安装 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.
4

2 回答 2

0

当我尝试使用 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
于 2021-06-23T22:24:48.503 回答
0

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

于 2020-12-14T23:59:12.080 回答