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

14,947

Solution 1

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

Solution 2

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

Share:
14,947

Related videos on Youtube

user6133116
Author by

user6133116

Updated on September 18, 2022

Comments

  • user6133116
    user6133116 over 1 year

    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?

  • user6133116
    user6133116 almost 8 years
    I tried it and it worked. Thanks. But I remember earlier when I installed mariadb I was prompted to set the root password. Since when was it changed?
  • David Foerster
    David Foerster almost 8 years
    @user6133116: That contradicts the statement in your question. Which one is it. Could you please clarify?
  • user6133116
    user6133116 almost 8 years
    @DavidFoerster I'm sorry, but I really don't see any contradiction. I think you might not have got the idea of my question.
  • David Foerster
    David Foerster almost 8 years
    “during the process [of the installation] I was not prompted to input the password for the mysql root account” (taken from your question, highlight by me) vs. “when I installed mariadb I was prompted to set the root password” (taken from your comment)
  • user6133116
    user6133116 almost 8 years
    @DavidFoerster "But I remember EARLIER when I installed mariadb I was prompted to set the root password. Since when was it changed?" Please pay attention to the word 'earlier' which I meant "some time ago, not this time". I was prompted to set the password for the database root account before, but not this time during this fresh install, hence the question posted in here.
  • user6133116
    user6133116 almost 8 years
    It could also be some confusion made by my usage of the English language, as I'm not an English native speaker. If that's the case, I'm sorry.
  • soufrk
    soufrk over 7 years
    Worked for MariaDB version 10.0.25 on Ubuntu 15.10.
  • Matthew Setter
    Matthew Setter over 3 years
    This doesn't work for MariaDB 10.3.22 on Ubuntu 20.04.