首先,当我尝试使用 安装 mysql 服务器时sudo apt install mysql-server
,它通常停留在 %81 阶段并等待如下所示的最后一行
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 12759
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
在 %81 或其他位置抛出错误后,它给出了错误
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后,当我想删除所有内容时,我挣扎了很久,删除所有内容后做了很多事情,然后尝试再次安装,但遇到了同样的问题。我还没能安装。
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 61198
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Progress: [ 94%] [##################################################################################################################################.........]
这是下面的日志/var/log/mysql/error.log
(它是在我尝试安装时创建的):
2021-01-07T16:37:31.913172Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-07T16:37:33.162774Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-07T16:37:36.489807Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-01-07T16:37:39.365949Z 6 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.22-0ubuntu0.20.04.3).
2021-01-07T16:37:44.690155Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 84654
2021-01-07T16:37:44.706661Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-07T16:37:44.926828Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-07T16:37:45.027382Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2021-01-07T16:37:45.027520Z 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'
2021-01-07T16:37:45.231071Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-07T16:37:45.231641Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-07T16:37:45.238549Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2021-01-07T16:37:45.277687Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22-0ubuntu0.20.04.3' socket: '/tmp/tmp.X9qpBhmSHc/mysqld.sock' port: 0 (Ubuntu).
2021-01-07T16:37:45.312794Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.22-0ubuntu0.20.04.3).
2021-01-07T16:37:46.863139Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22-0ubuntu0.20.04.3) (Ubuntu).
2021-01-07T16:37:47.950414Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 84719
2021-01-07T16:37:47.957833Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-07T16:37:48.187217Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-07T16:37:48.275665Z 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'
2021-01-07T16:37:48.275861Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060
2021-01-07T16:37:48.388116Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-07T16:37:48.388695Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-07T16:37:48.397497Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2021-01-07T16:37:48.444139Z 7 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.22-0ubuntu0.20.04.3).
2021-01-07T16:37:49.863113Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22-0ubuntu0.20.04.3) (Ubuntu).
2021-01-07T16:37:51.181843Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 84873
2021-01-07T16:37:51.194900Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-07T16:37:51.406520Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-07T16:37:51.504461Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2021-01-07T16:37:51.619732Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-07T16:37:51.620324Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-07T16:37:51.647930Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22-0ubuntu0.20.04.3' socket: '/var/run/mysqld/mysqld.sock' port: 0 (Ubuntu).
答案1
如果您的系统内存不足,则可能导致您在安装 mysql 时遇到错误。检查 /var/log/syslog 是否存在内存不足错误。