apt-get purge mariadb 留下痕迹,导致 mysql 安装停止

apt-get purge mariadb 留下痕迹,导致 mysql 安装停止

我正在尝试对我正在开发的网站上的数据库问题进行错误测试。我想看看在 mariadb 和 MySQL 之间切换是否能解决这个问题(尽管可能性不大)。我以为这会是开发机器上的一个简单过程(我没有任何需要担心/备份的数据)。

我使用了命令

sudo apt-get purge mariadb*

然后我进入

sudo apt-get install mysql-server

并惊讶地收到这个可爱的错误。

   invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--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.5; however:
  Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up libmariadbclient18 (5.5.32+maria-1~precise) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                          Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试了 dkpg --configure -a 并得到了这个

Setting up mysql-server-5.5 (5.5.31-0ubuntu0.12.04.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--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.5; however:
  Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server

我注意到有一行字是

setting up libmariadbclient18

这对我来说毫无意义,因为我之前已经清除了 mariadb*。有人知道发生了什么吗?

更新 我直击问题的核心,并且

sudo apt-get install mysql-client-5.5

并受到

Note, selecting 'mariadb-client-5.5' instead of 'mysql-client-5.1'

不确定发生了什么。

更新2

sudo apt-get purge libmariadbclient-dev

我安装了正确的客户端,但安装时仍然出现错误。

答案1

您忘记移除libmariadbclient18包裹了。请先移除它。

答案2

如果您可以卸载 mysql-server 并删除所有数据库,您可以尝试这个(再次确保您拥有所有数据库的有效备份):

rm -rf /var/lib/mysql

然后重新安装 mysql-server。

相关内容