我遇到了一些无法mysqld
启动的问题,因此我想清除或(至少)重新安装其文件,以便用库存文件替换当前配置文件,以便它能够再次启动。
这是以下内容journalctl -xeu mysqld.service
:
░░ The job identifier is 276.
sep. 30 08:03:48 oberkommando systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mysqld.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
sep. 30 08:03:48 oberkommando systemd[1]: mysqld.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
sep. 30 08:03:48 oberkommando systemd[1]: Failed to start mysqld.service - MySQL Server.
░░ Subject: A start job for unit mysqld.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has finished with a failure.
░░
░░ The job identifier is 276 and the job result is failed.
这是以下内容/var/log/mysqld.log
:
2022-09-28T22:24:53.958318Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2022-09-28T22:24:53.958374Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 11 in a file operation.
2022-09-28T22:24:53.958389Z 1 [ERROR] [MY-012596] [InnoDB] Error number 11 means 'Resource temporarily unavailable'
2022-09-28T22:24:53.958410Z 1 [ERROR] [MY-012215] [InnoDB] Cannot open datafile './ibdata1'
2022-09-28T22:24:53.958444Z 1 [ERROR] [MY-012959] [InnoDB] Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2022-09-28T22:24:53.958457Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Cannot open a file.
2022-09-28T22:24:54.458706Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-09-28T22:24:54.458838Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-09-28T22:24:54.458861Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-28T22:24:54.459186Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-29T09:52:22.805182Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1440
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-29T09:52:22.817204Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-29T09:52:22.817266Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-29T10:09:29.182680Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1455
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-29T10:09:29.186705Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-29T10:09:29.186770Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-29T10:14:02.494574Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 5767
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-29T10:14:02.495732Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-29T10:14:02.495795Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-29T19:49:57.027740Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1439
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-29T19:49:57.040203Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-29T19:49:57.040260Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-29T19:51:25.624747Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2022-09-29T19:51:25.624780Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 2639
2022-09-29T19:51:25.626154Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2022-09-29T19:51:25.626157Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-29T19:51:25.626617Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-29T19:51:25.626673Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
2022-09-30T06:03:48.888324Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2022-09-30T06:03:48.888374Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1454
2022-09-30T06:03:48.900171Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2022-09-30T06:03:48.900174Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-09-30T06:03:48.901992Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-09-30T06:03:48.902046Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
我使用的是 Fedora 36 并安装了以下软件包
mysql80-community-release-fc36-1.noarch
mysql-community-common-8.0.30-10.fc36.x86_64
mysql-community-client-plugins-8.0.30-10.fc36.x86_64
mysql-community-libs-8.0.30-10.fc36.x86_64
mysql-community-client-8.0.30-10.fc36.x86_64
mysql-community-icu-data-files-8.0.30-10.fc36.x86_64
mysql-community-server-8.0.30-10.fc36.x86_64
mysql-workbench-community-8.0.30-1.fc36.x86_64
使用MySQL 的网站。
问题是我想卸载它,但它想删除太多依赖项,而 Fedora 不允许保留已安装的依赖项(如果这意味着它们已损坏)。
答案1
sudo systemctl stop mysqld # not sure it's called this way
sudo rm -rf /var/lib/mysql # this will wipe out all the data inside the database - @toppk
sudo dnf reinstall mysql-community-server