14

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?

4
  • Does your terminal prompt have a $ or a #? (I ask because normal users have $ in the prompt, but root has #) Jul 13, 2016 at 14:29
  • 2
    @NickWeinberg I think the issue here is the database root password not the system root password Jul 13, 2016 at 14:30
  • @steeldriver Ahh, ok. I was confused because of the "sudo apt-get" command and "not being asked to input the password for root". But I think you're right Jul 13, 2016 at 14:31
  • @DavidFoerster I was trying to login as root in mariadb (not root in linux) by "mysql -u root -p" Jul 14, 2016 at 1:00

2 Answers 2

18

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
9
  • 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? Jul 14, 2016 at 1:04
  • @user6133116: That contradicts the statement in your question. Which one is it. Could you please clarify? Jul 14, 2016 at 12:30
  • @DavidFoerster I'm sorry, but I really don't see any contradiction. I think you might not have got the idea of my question. Jul 14, 2016 at 12:34
  • “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) Jul 14, 2016 at 12:46
  • @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. Jul 14, 2016 at 14:23
4

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.