我的MySQL社区安装被破坏,所以我重新安装了它。现在,它根本不会安装。救命!
这是运行sudo apt-get install mysql-server
Setting up mysql-client-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/mysql/debian-start ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 2 - No such file or directory)
2020-03-24T11:41:39.379271Z 0 [Note] mysqld (mysqld 5.7.29-0ubuntu0.18.04.1-log) starting as process 1856 ...
2020-03-24T11:41:39.381242Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
2020-03-24T11:41:39.381859Z 0 [ERROR] Aborting
2020-03-24T11:41:39.381970Z 0 [Note] Binlog end
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (237-3ubuntu10.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@honeyfrost:/# apt-get --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 2 - No such file or directory)
2020-03-24T11:42:48.824469Z 0 [Note] mysqld (mysqld 5.7.29-0ubuntu0.18.04.1-log) starting as process 2754 ...
2020-03-24T11:42:48.827477Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
2020-03-24T11:42:48.828517Z 0 [ERROR] Aborting
2020-03-24T11:42:48.828544Z 0 [Note] Binlog end
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
如果我随后运行sudo systemctl start mysql
,就会出现:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
如果我通过执行sudo systemctl status mysql
检查状态,就会出现:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-03-24 12:46:55 CET; 1min 2s ago
Process: 2930 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Mar 24 12:46:55 honeyfrost systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Mar 24 12:46:55 honeyfrost systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Mar 24 12:46:55 honeyfrost systemd[1]: Stopped MySQL Community Server.
Mar 24 12:46:55 honeyfrost systemd[1]: mysql.service: Start request repeated too quickly.
Mar 24 12:46:55 honeyfrost systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 24 12:46:55 honeyfrost systemd[1]: Failed to start MySQL Community Server.
我已经在Google上搜索了几个小时,但找不到任何有效的方法。我尝试删除与mysql相关的所有文件夹,但问题仍然存在!请帮助
编辑:执行sudo apt-get purge *mariadb*
时,尝试清除mariadb-server-10.4时出现错误
The following packages will be REMOVED:
mariadb-server-10.4*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 131562 files and directories currently installed.)
Purging configuration files for mariadb-server-10.4 (1:10.4.12+maria~bionic) ...
find: ‘/var/lib/mysql’: No such file or directory
dpkg: error processing package mariadb-server-10.4 (--purge):
installed mariadb-server-10.4 package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
mariadb-server-10.4
E: Sub-process /usr/bin/dpkg returned an error code (1)