Ubuntu – Mariadb not working just after install on Ubuntu 16.04

16.04mariadbMySQL

Hi I have installed MariaDB server and mariaDB client, php7.0-mysql on my fresh Ubuntu 16.04 VPS, but after installation I cant login using PhpMyAdmin, when I am trying to login using PHPMyAdmin its always give Access denied for user 'root'@'localhost' error.

here is some info.
If try to get status

root@ubuntu-2gb-ams2-01:/var/lib# service mariadb status
● mariadb.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

When I tried to start get this

# service mariadb start
Failed to start mariadb.service: Unit mariadb.service not found.

I can login and create new database with SSH

root@ubuntu-2gb-ams2-01:/var/lib# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 61
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database protest;
Query OK, 1 row affected (0.00 sec)

If I want to see database then I can see all database

root@ubuntu-2gb-ams2-01:/var/lib# mysql -u root -p -e 'show databases'
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| protest            |
+--------------------+

So its look like Mariadb is installed but cant understand why status showing dead, start/restart not working, front end login not working (using phpmyadmin, can anyone give a clue?

UPDATE: I just created another DB and user, I can login that user and access db using phpmyadmin.

Best Answer

If you check mysql --version it should say something like:

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

Then you know you're indeed running mariaDB then you can simply

sudo service mysql restart

and it should be all good!

Worth to lookup the file in /lib/systemd/system/mariadb.service to see that it uses mysqld.