我的 MariaDB 安装已损坏,我正在尝试清理并重新安装。
如果我这样做,sudo apt-get upgrade
我会得到以下删除:
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
mariadb-galera-server : Depends: mariadb-galera-server-5.5 (= 5.5.40+maria-1~wheezy) but it is not installed
E: Unmet dependencies. Try using -f.
如果我跑步sudo apt-get install -f
我会得到:
Preconfiguring packages ...
(Reading database ... 31610 files and directories currently installed.)
Unpacking mariadb-galera-server-5.5 (from .../mariadb-galera-server-5.5_5.5.40+maria-1~wheezy_amd64.deb) ...
Stopping MariaDB database server: mysqld failed!
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 1
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing /var/cache/apt/archives/mariadb-galera-server-5.5_5.5.40+maria-1~wheezy_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-galera-server-5.5_5.5.40+maria-1~wheezy_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
如果我尝试使用卸载,sudo apt-get --purge remove mariadb-galera-server-5.5 mariadb-galera-server mariadb-common
我会得到:
The following packages have unmet dependencies:
libmariadbclient18 : Depends: mariadb-common but it is not going to be installed
mariadb-client-5.5 : Depends: mariadb-common but it is not going to be installed
mariadb-client-core-5.5 : Depends: mariadb-common but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我已经没有什么可以尝试的了,非常感谢任何帮助。
答案1
这似乎是一个已知问题正如这里报道的那样。最实际的解决方案是首先终止所有mysqld
正在运行的实例:
sudo killall mysqld
然后按照建议运行此命令,让 MariaDB 再次运行:
sudo apt-get -f install
如果由于某种原因该命令不起作用,请dpkg --configure -a
在前面的命令之前运行并重试。
答案2
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
昨天我遇到了这个问题,当时 mariadb 10.1 服务器包无法正确更新和安装。最后删除以下符号链接可能已经解决了这个问题。
root@box{~}:la /etc/systemd/system/mysql.service
lrwxrwxrwx 1 root root 35 Feb 9 22:55 /etc/systemd/system/mysql.service -> /lib/systemd/system/mariadb.service
我收到的主要错误消息是。
Failed at step NO_NEW_PRIVILEGES spawning /usr/sbin/mysqld: Invalid argument
我发现 mariadb 故障排除指南很有帮助,但我找不到任何地方看到的错误消息的答案。直到我尝试安装 Perconadb 作为替代替代品时,我才找到了那个符号链接。
https://mariadb.com/kb/en/mariadb/troubleshooting-installation-issues/
答案3
如果上述解决方法均不起作用,请尝试这两个命令。
sudo rm /etc/systemd/system/mysqld.service
sudo rm /etc/systemd/system/mysql.service
然后运行
sudo apt -f install
答案4
对于我来说,它始于当我使用 mariadb 安装 akeneo 时,我收到错误:
+---------+----------------------------------------------------------------------------------------------------------------------------+
| Check | Errors
|
+---------+----------------------------------------------------------------------------------------------------------------------------+
| ERROR | Install MySQL greater or equal to 5.7.0 and lower than 5.8.0 (installed version is 5.5.5-10.1.30-MariaDB-0ubuntu0.17.10.1) |
+---------+----------------------------------------------------------------------------------------------------------------------------+
由于某种原因,Akeneo 无法使用此设置,尽管 mariadb 似乎基于 mysql 5.7。所以我需要将 mariadb 切换到 mysql-server。
sudo apt-get install mysql-server
安装删除了 mariadb,但将重新安装 mysql 出现此错误:
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
我找不到任何正在运行的 SQL Server
sudo ps -aux | grep sql
或者其他什么,所以我尝试卸载所有与 mysql 相关的软件包。无论我接下来尝试什么,无论是清除、卸载 mysql-server 还是 mariadb,都无济于事,甚至:
apt --fix-broken install
所以我必须用以下方法寻找包:
sudo dpkg --get-selections | grep mysql
这给了我:
libdbd-mysql-perl install
libmysqlclient20:amd64 install
mysql-client-5.7 install
mysql-client-core-5.7 install
mysql-common install
mysql-server install
mysql-server-core-5.7 install
php-mysql install
php7.1-mysql install
和
sudo dpkg --get-selections | grep mariadb
这给了我:
mariadb-client-10.1 deinstall
mariadb-common install
mariadb-server-10.1 deinstall
然后我继续删除所有我发现的软件包
sudo dpkg -P <packagename>
最后我可以重新安装
sudo apt-get install mysql-server