Debian9系统下,安装MariaDB10 换以下各种方式安装不上去,网上搜索的1~5中的方式都有人解决成功过,具体方式贴在下面:
报错:
mariadb-server : Depends: mariadb-server-10.4 (>= 1:10.4.7+maria~stretch) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
解决方式:
1. 刚开始只是更新apt后安装,执行命令和报错具体如下所示
sudo apt-get update
sudo apt-get install mariadb-server
root@instance-tbbjrcnc:/etc/apt/sources.list.d# sudo apt-get install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.4 (>= 1:10.4.7+maria~stretch) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
2. 换配置mariadb版本 10.1版本:
sudo apt-get install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.dotsrc.org/mariadb/repo/10.1/debian stretch main'
sudo apt-get update
sudo apt-get install mariadb-server
3. 换配置mariadb版本 10.2
sudo apt-get install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.dotsrc.org/mariadb/repo/10.2/debian stretch main'
sudo apt-get update
sudo apt-get install mariadb-server
3. 换配置mariadb版本 10.3
sudo apt-get install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.dotsrc.org/mariadb/repo/10.3/debian stretch main'
sudo apt-get update
sudo apt-get install mariadb-server
4. 换配置mariadb版本 10.4
sudo apt-get install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.dotsrc.org/mariadb/repo/10.4/debian stretch main'
sudo apt-get update
sudo apt-get install mariadb-server
以上方式都是官网查到,我都试了不行。
5. 以下方式试了也不行
apt-get install aptitude
aptitude update
aptitude upgrade
aptitude dist-upgrade
aptitude install mariadb-server
6. 最终解决方式:
aptitude install mariadb-server
当你运行上边的命令,会出现:
y/n/q
当你选择n的时候,它会显示另一个解决方法,我当时直接y并没有安装成功,
第二次我选n,它提供另一种解决方式,问题解决。
参考链接: