Not prompted to input the root password when installing mariadb-server on Ubuntu 16.04 LTS

I just had a fresh install on my pc the Ubuntu 16.04 LTS. When I tried to install MariaDB by typing:

sudo apt-get install mariadb-server

The installation went smoothly but during the process I was not prompted to input the password for the mysql root account. After the installation I was unable to log into MariaDB (mysql -u root -p) and it showed the error message:

ERROR 1698 Access denied for user 'root'

Everything was a fresh install. The entries in /etc/apt/sources.list were checked and all major components were enabled properly.

What seems to be the problem?


Mariadb package doesn't offer a configuration wizard during installation on Ubuntu 16.04.

Use the below command to have a mysql shell

sudo mysql -uroot

Try sudo mysql -u root. You should be able to login this way.