我在 Digital Ocean VM 上运行 Ubuntu 14.04。我尝试安装 MariaDB 10.1。安装时出现以下错误:
Setting up mariadb-server-10.1 (10.1.8+maria-1~trusty) ...
dpkg: error processing package mariadb-server-10.1 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mariadb-server:
mariadb-server depends on mariadb-server-10.1 (= 10.1.8+maria-1~trusty); however:
Package mariadb-server-10.1 is not configured yet.
dpkg: error processing package mariadb-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:
mariadb-server-10.1
mariadb-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
以下是我尝试修复此问题的方法:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mariadb-server
和
重启机器
我在 Stack Exchange 和其他 Linux 表单上搜索了一段时间,但还是无法弄清楚是什么原因造成的。如果您能提供任何帮助,我将不胜感激!
更新:这是输出apt-get install -f
:
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 mariadb-server-10.1 (10.1.8+maria-1~trusty) ...
dpkg: error processing package mariadb-server-10.1 (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of mariadb-server:
mariadb-server depends on mariadb-server-10.1 (= 10.1.8+maria-1~trusty); however:
Package mariadb-server-10.1 is not configured yet.
dpkg: error processing package mariadb-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mariadb-server-10.1
mariadb-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
在日志中发现:
[ERROR] /usr/sbin/mysqld: unknown variable log_slow_queries=/var/log/mysql/mysql-slow.log'
所以我注释掉了conf.d/local.cnf
#log_slow_queries=/var/log/mysql/mysql-slow.log'
最终安装成功结束。
答案2
尝试将 /var/lib/mysql 中的所有文件备份到某处。删除它们,然后执行 mysql_install_db。
我的问题来自于删除 mysqld 并将其替换为 mariadb 并尝试保留数据库文件。所有其他方法对我来说都失败了。
答案3
您的系统在运行 mariadb-server-10.1 包的 (post)configure 脚本时遇到问题。
首先,尝试使用清理 apt 缓存apt-get clean
并重新安装该包(请注意,apt-get autoclean
仅部分清理缓存)。
如果失败了,您必须使用dpkg -i mariadb-server-10.1
和/或dpkg-reconfigure mariadb-server-10.1
来更深入地查看特定的错误。
答案4
请参阅以下链接: https://unix.stackexchange.com/questions/249530/mariadb-dependency-problems-leaving-unconfigured
主要>从头安装所有内容:将以下内容添加到您的/etc/apt/sources.list
文件中:
deb [arch=amd64,i386] http://ftp.utexas.edu/mariadb/repo/10.1/debian jessie main
deb-src http://ftp.utexas.edu/mariadb/repo/10.1/debian jessie main