MariaDB - 依赖性问题 - 未配置

MariaDB - 依赖性问题 - 未配置

我尝试在 Debian Jessie 8.1 上安装 ISPConfig3,但它无法连接到 mySQL (mariaDB 10.1)。所以我按 CTRL+C 终止安装,并尝试手动登录 mySQL,但失败了。它在抱怨套接字。所以我清除并删除了 mariaDB 和 mySQL:

service mysql stop
apt-get --purge remove "mysql*"
mv /etc/mysql/ /tmp/mysql_configs/
apt-get remove --purge mysql*
apt-get autoremove
apt-get autoclean
service apache2 restart
apt-get update

在 source.list 中我有(添加了最后两行)( nano /etc/apt/sources.list):

deb http://debian.mirror.constant.com/ jessie main contrib non-free
deb-src http://debian.mirror.constant.com/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

deb [arch=amd64,i386] http://ftp.utexas.edu/mariadb/repo/10.0/debian jessie main
deb-src http://ftp.utexas.edu/mariadb/repo/10.0/debian jessie main

然后我按照给出的命令进行操作玛丽亚数据库:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo apt-get update
sudo apt-get install mariadb-server

我收到以下错误:

Setting up mariadb-server-10.1 (10.1.9+maria-1~jessie) ...
2015-12-15 11:26:57 140472422967232 [Note] /usr/sbin/mysqld (mysqld 10.1.9-MariaDB-1~jessie) starting as process 12018 ...
2015-12-15 11:26:57 140472422967232 [Note] Using unique option prefix 'myisam_recover' is error-prone and can break in the future. Please use the full name 'myisam-recover-options' instead.
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: The InnoDB memory heap is disabled
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Memory barrier is not used
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Using Linux native AIO
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Using CPU crc32 instructions
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Completed initialization of buffer pool
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Highest supported file format is Barracuda.
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: 128 rollback segment(s) are active.
2015-12-15 11:26:57 140472422967232 [Note] InnoDB: Waiting for purge to start
2015-12-15 11:26:57 140472422967232 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.26-74.0 started; log sequence number 19615081045
2015-12-15 11:26:57 140471636559616 [Note] InnoDB: Dumping buffer pool(s) not yet started
2015-12-15 11:26:58 140472422967232 [Note] Plugin 'FEEDBACK' is disabled.
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript mysql, action "start" failed.
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.9+maria-1~jessie); 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

请尝试以下操作:

apt-get remove --purge mysql*
apt-get remove --purge mysql
apt-get remove --purge mariadb
apt-get remove --purge mariadb*
apt-get --purge remove mariadb-server
apt-get --purge remove python-software-properties

注意:当提示您是否要转储当前数据库时,请说“不”。但您可以轻松取消配置 phpmyadmin 数据库。

从新安装所有内容:将以下内容添加到您的/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

然后,

apt-get install python-software-properties
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
apt-get install software-properties-common
apt-get install mariadb-server mariadb-client

完成后,您应该能够运行mysql -V并看到类似以下内容:

mysql  Ver 15.1 Distrib 10.1.9-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

答案2

我刚刚收到这个错误。对于新来的人。

问题是由于mysql数据库丢失。因为我删除了文件夹/var/lib/mysql//etc/mysql/.

我刚刚执行了sudo mysql_install_db。然后启动MySql服务sudo service mysql start。它应该有效。

如果执行时出现错误sudo mysql_install_db,请执行sudo mkdir /etc/mysql/conf.d/。然后重新开始。

答案3

我在从 Ubuntu 14.04 升级的 Ubuntu 16.04 上安装 MariaDB 服务器 10.0 时遇到了非常类似的问题。

Setting up mariadb-server-10.0 (10.0.31-0ubuntu0.16.04.2) ...
dpkg: error processing package mariadb-server-10.0 (--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.0 (>= 10.0.31-0ubuntu0.16.04.2); however:
  Package mariadb-server-10.0 is not configured yet.

dpkg: error processing package mariadb-server (--configure):
 dependency problems - leaving unconfigured

@user3502626 的答案给出了使用 的提示sudo mysql_install_db,这提供了一个新的错误:

/usr/sbin/mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 13 "Permission denied")

搜索该错误导致一份 Debian 错误报告指出了 AppArmor 的问题,并且可以用以下方法解决:

$ echo -n "/usr/sbin/mysqld" | sudo tee /sys/kernel/security/apparmor/.remove
$ apt install -f
$ apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld

这样就正确安装了 MariaDB。

答案4

您的主目录中有 .my.cnf 文件吗?这导致了我的错误。我只是删除它并重新启动安装过程。

相关内容