不幸的是,我卸载了 MySQL。稍后尝试安装时,出现以下错误:
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
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):
subprocess installed post-installation script 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.23-0ubuntu11) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (229-4ubuntu21.16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
我已尝试以下步骤
- 完全删除 MySQL 服务器并尝试再次安装。
sudo dpkg --configure -a
apt-get install -f
但是没用。
答案1
您的系统可能缺少某些配置文件。运行以下命令来恢复它们:
apt-get -o Dpkg::Options::="--force-confmiss" install mysql-server
有可能,您在执行此命令时会收到错误,但文件夹/etc/mysql/conf.d/
现在应该在那里。如果命令失败,您必须手动启动 mysql:
service mysql start
然后运行以下命令完成安装:
apt-get install -f mysql-server