5

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.
2
  • First run sudo apt-get remove --purge mariadb-server & then try to install
    – d a i s y
    May 11, 2016 at 10:18
  • 2
    sudo: /etc/sudoers.d is world writable is the error in your case, the directory is world writable ? if yes, correct this first. May 11, 2016 at 10:45

8 Answers 8

5

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

3

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
1

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

1
  • kill -9 is dubious advice.
    – tripleee
    Apr 11, 2018 at 6:54
1

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.

1
  • Could you please detail the commands to perform to both clean /var/lib/mysql and reinstall mariadb? Oct 3, 2016 at 8:20
0

Here are the commands to run to install MariaDB on your Ubuntu system:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386] http://mirrors.hustunique.com/mariadb/repo/10.1/ubuntu xenial main'

Once the key is imported and the repository added you can install MariaDB with:

sudo apt-get update
sudo apt-get install mariadb-server
4
  • Yes. I followed all the steps from downloads.mariadb.org/mariadb/repositories/…. Updated the questions to include those steps
    – Amit Patel
    May 11, 2016 at 10:26
  • sudo apt-get install mariadb-server-10.1=10.1.14+maria-1~trusty
    – Eofla
    May 11, 2016 at 10:28
  • @Eofla sudo apt-get install mariadb-server-10.1=10.1.14+maria-1~trusty is completely wrong.
    – d a i s y
    May 11, 2016 at 10:29
  • I meant sudo apt-get install mariadb-server-10.1
    – Eofla
    May 11, 2016 at 10:30
0

Mariadb is available in official Ubuntu repositories so no need to enable third-party repositories. Ubuntu has official repositories called main, universe & multiverse. Most likely your installation has only main enabled. You can enable universe with How do I enable the "Universe" repository?

sudo add-apt-repository universe
0

I am using Ubuntu 18.04 and got the same error when I wanted to install mariadb. The one solution above worked for me, although the were some error messages about old packages.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386] http://mirrors.hustunique.com/mariadb/repo/10.1/ubuntu xenial main'

Followed by:

sudo apt-get update
sudo apt-get install mariadb-server
0

To install MariaDB you need to use the right installation file on Ubuntu

sudo apt-get install mariadb-server-core-10.1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .