1

I am running MariaDB 10.0.24 on Ubuntu 16.04. I installed it via the xenial repo apt-get install mariadb-server.

The root password doesn't seem to be working properly. I ran through these steps to set the password: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html but I get the following behaviour:

When I do sudo mysql or sudo mysql -u root it gets me into console without asking for password (why can I get in without password?)

When I do sudo mysql -u root -p it asks me for a password but will let me into mysql console regardless of what string I enter. Why does it let me in when giving an incorrect password?

When I do mysql -u root it asks me for password but will not accept the password I set following the instructions in the linked article.

Something is obviously not right. Does anyone know why its not asking for password from root at all and not accepting password from my user?

1

sudo mysql && sudo mysql -u root it's redundant command. Not assks for password because you have a file named /root/.my.cnf with with client name and password

sudo mysql -u root -pask for passowrd because you put -p in your coammand (see man mysql)

·   --password[=password], -p[password]

           The password to use when connecting to the server. If you use the short option form (-p), you cannot have a
           space between the option and the password. If you omit the password value following the --password or -p option
           on the command line, mysql prompts for one.

           Specifying a password on the command line should be considered insecure. See Section 6.1.2.1, “End-User
           Guidelines for Password Security”. You can use an option file to avoid giving the password on the command line.

Please read En-user guidelines for Password Security

Especially for the user question

As Ubuntu 16.04 uses Xenial this is a little peculiar in the way they control certain things, and working with a plug that affects as we used many system administrators.

mysql> use mysql; mysql> update user set plugin='' where User='root'; mysql> flush privileges;

  • that was psuedo, i just meant that both of those commands give that result. I think you missed my meaning. Usually it expects a correct password but it just accepts any string – Guerrilla May 2 '16 at 5:48
  • I updated the phrasing of my question to hopefully be less ambiguous. – Guerrilla May 2 '16 at 5:50
  • Please.. search and read /root/.my.cnf and /home/<user>/.my.cnf If search, read, and read link on reply you will understand what question. Question it's over this file, named .my.cnf – abkrim May 2 '16 at 5:52
  • I don't have any file there. Root directory just contains bash config. – Guerrilla May 2 '16 at 6:09
  • Sure? please put ls -lisa /home/<user>/ <user> It must be replaced by the user executing sudo – abkrim May 2 '16 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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