Unable to install MariaDB on 16.04 - unmet dependency

51,563

Solution 1

Please check that Apache and php packages exist or not in your machine.

Please follow this steps to completely remove MySQL

Now open the terminal Ctrl + T

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean

Install apache

sudo apt-get install apache2

Install php

sudo apt-get install libapache2-mod-php mysql-server mysql-client
sudo mysql_install_db
sudo mysql_secure_installation

Now open mysql in terminal

mysql -u root -p

Please note the version of php. ref reason why php 7

Their is one way to install php 5 by adding ppa If you want version 5 php.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6

Other Ref : php version issue

Thanks Ajay

Solution 2

In my case, the ibdata1 file was corrupt. I fixed as follows:

$ sudo apt-get purge mariadb-*
$ sudo rm -f /var/lib/mysql/ib*
$ sudo apt-get install mariadb-server

Solution 3

I got the same error, but it turned out to be because I had installed std mysql and had uninstalled it. The cure was deleting the /var/lib/mysql directory and running the mariadb install again.

Solution 4

If you installed MariaDB/MySQL server before, remove them first:

sudo apt-get remove mariadb-server mariadb-client mysql-server mysql-client

Then make sure no mysqld process is running.

sudo kill -9 $(pgrep mysql)

After that, install MariaDB server. if you still see the same error, you should check out MariaDB error log /var/log/mysql/error.log to find out the cause.

source: linuxbabe.com - install MariaDB 10.1 on Ubuntu 14.04 and 16.04

Share:
51,563

Related videos on Youtube

Amit Patel
Author by

Amit Patel

Updated on September 18, 2022

Comments

  • Amit Patel
    Amit Patel over 1 year

    Here are the steps

    1. sudo apt-get install software-properties-common
    2. sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

    3. $ sudo add-apt-repository 'deb [arch=amd64,i386] http://mirror.fibergrid.in/mariadbrepo/10.1/ubuntu xenial main'

    4. sudo apt-get update
    5. sudo apt-get install mariadb-server

    Error

    sudo: /etc/sudoers.d is world writable
    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.1 (= 10.1.14+maria-1~trusty) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    
    • Admin
      Admin almost 8 years
      First run sudo apt-get remove --purge mariadb-server & then try to install
    • Admin
      Admin almost 8 years
      sudo: /etc/sudoers.d is world writable is the error in your case, the directory is world writable ? if yes, correct this first.
  • Amit Patel
    Amit Patel almost 8 years
    Yes. I followed all the steps from downloads.mariadb.org/mariadb/repositories/…. Updated the questions to include those steps
  • Eofla
    Eofla almost 8 years
    sudo apt-get install mariadb-server-10.1=10.1.14+maria-1~trusty
  • d a i s y
    d a i s y almost 8 years
    @Eofla sudo apt-get install mariadb-server-10.1=10.1.14+maria-1~trusty is completely wrong.
  • Eofla
    Eofla almost 8 years
    I meant sudo apt-get install mariadb-server-10.1
  • Sylvain Pineau
    Sylvain Pineau over 7 years
    Could you please detail the commands to perform to both clean /var/lib/mysql and reinstall mariadb?
  • tripleee
    tripleee about 6 years
    kill -9 is dubious advice.