MySQL (MariaDB) Not Starting

Solution 1:

If you haven't any real data in your database then clear all in /var/lib/mysql.

After that try again to run command mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql to initialize database directory.

Solution 2:

You need to run mysql_install_db to initialize MySQL data directory.


Solution 3:

cd /var/lib/mysql
ls
rm -r *
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl start mysqld
systemctl start mysql.service
systemctl start mariadb
mysql

Then it works just fine


Solution 4:

Faced same problem. This got resolved after following below steps:

  1. Uninstalled the mariadb maridb-server packages
  2. Removed the directory /var/lib/mysql.
  3. Reinstalled the Mariadb, Mariadb-server packages.
  4. systemct start mariadb; systemctl enable mariadb

(problem solved).


Solution 5:

I had same problem on Ubuntu 18.04m packages registered seem unable to start or else...

I resolved by adding correct package list and signature from the this site.

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,arm64,ppc64el] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server

et voila..