无法卸载并重新安装 mySQL

无法卸载并重新安装 mySQL

我不知何故失去了连接到本地 MySQl 服务器 (Linux Mint 17.3) 的能力,因此我找到了卸载然后重新安装 MySQL 的说明,但这似乎不起作用。我尝试了多个不同的控制台命令来执行此操作,但到目前为止都没有成功,我使用的命令示例如下:

sudo mysqld stop
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server

结果是:

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--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.6; however:
  Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-server-5.6
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

有趣的是,作业启动失败错误是我在这一切发生之前遇到的错误。在这一切开始发生之前我唯一做的事情就是安装 cakephp,所以我真的很困惑,为什么这一切会突然发生。

编辑我现在收到的错误是:

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--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.6; however:
  Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.6
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑2:

收到错误消息:你的系统上有一个损坏的软件包,请使用损坏的过滤器来找到它

因此尝试了以下方法:

进入 Synaptic,下拉“编辑”菜单,单击“修复损坏的软件包”,然后单击“应用”。大多数情况下,损坏的软件包是缺少依赖项的软件包。

并收到错误消息:

E: /var/cache/apt/archives/mysql-server-5.5_5.5.52-0ubuntu0.14.04.1_amd64.deb: subprocess new pre-installation script returned error exit status 1

编辑 3:我按照此处的说明在虚拟机上执行了 lamp 的空白安装:http://tecadmin.net/install-php-7-0-apache-2-4-mysql-5-6-on-ubuntu/

并且错误也在这里出现!

编辑4:我尝试了Minigeek的建议,但是终端再次出现错误:

sudo software-properties-gtk 
Error: Can't find the age of https://mirrors.c0urier.net/?dir=linux/linuxmint/packages/db/version !!
/usr/lib/linuxmint/mintSources/mintSources.py:499: GtkWarning: IA__gtk_list_store_set_value: assertion 'VALID_ITER (iter, list_store)' failed
  model.set_value(iter, MirrorSelectionDialog.MIRROR_SPEED_COLUMN, download_speed)
/usr/lib/linuxmint/mintSources/mintSources.py:500: GtkWarning: IA__gtk_list_store_set_value: assertion 'VALID_ITER (iter, list_store)' failed
  model.set_value(iter, MirrorSelectionDialog.MIRROR_SPEED_LABEL_COLUMN, self._get_speed_label(download_speed))
/usr/lib/linuxmint/mintSources/mintSources.py:443: GtkWarning: gtk_list_store_get_value: assertion 'VALID_ITER (iter, list_store)' failed
  mirror = self._mirrors_model.get_value(iter, MirrorSelectionDialog.MIRROR_COLUMN)
Unhandled exception in thread started by <bound method MirrorSelectionDialog._all_speed_tests of <__main__.MirrorSelectionDialog object at 0x7f19ee330850>>
Traceback (most recent call last):
  File "/usr/lib/linuxmint/mintSources/mintSources.py", line 443, in _all_speed_tests
    mirror = self._mirrors_model.get_value(iter, MirrorSelectionDialog.MIRROR_COLUMN)
TypeError: unknown type (null)
Error '(28, 'Connection timed out after 5000 milliseconds')' on url http://mirror.krystal.co.uk/ubuntu
/usr/lib/linuxmint/mintSources/mintSources.py:497: GtkWarning: IA__gtk_list_store_remove: assertion 'VALID_ITER (iter, list_store)' failed
  model.remove(iter)
Unhandled exception in thread started by <bound method MirrorSelectionDialog._all_speed_tests of <__main__.MirrorSelectionDialog object at 0x7f19ee330850>>
Traceback (most recent call last):
  File "/usr/lib/linuxmint/mintSources/mintSources.py", line 443, in _all_speed_tests
    mirror = self._mirrors_model.get_value(iter, MirrorSelectionDialog.MIRROR_COLUMN)
TypeError: unknown type (null)

(synaptic:6925): Gtk-CRITICAL **: gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed

答案1

 sudo apt-get autoclean

删除 sources.list 文件并创建新的 sources.list...

sudo rm /etc/apt/sources.list 

然后输入

sudo software-properties-gtk 

在此处输入图片描述 这将打开 software-properties-gtk 并自动创建一个 newsources.list。

然后将服务器更改为美国或您选择的任何其他服务器。您必须从新对话框中启用存储库才能创建新的 sources.list。

勾选所有框然后单击“恢复”,再单击“关闭”。

需要恢复默认存储库

 sudo apt-get update && sudo apt-get dist-upgrade -y

(最好在安装之前备份此文件,以便在发生此类情况时进行恢复)

现在安装任何东西! sudo apt-get install mysql-server

相关内容