2

I am running a brand new Ubuntu 16.04 virtual machine to perform some testes with MariaDB AND Nginx AND PHP7.

When I was installing MariaDB (trough apt-get install mariadb-server) I was not asked to set a password for root user, like it is when we do install MySql-server.

Then I installed MySql Workbench as a client to MariaDB server.

When I try to connect to the db server as a root with no password, I have an error like the picture below: enter image description here

As you can see in the picture below, the root user has no password, and I have created another user with no password using this syntax: CREATE USER 'ig2'@'localhost' IDENTIFIED BY ''. enter image description here

So now, when I try to to connect the just created user ig2 with no password I have a warning and a successful connection. enter image description here enter image description here

So, I sit a password to the root user with this syntax: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123'); and now the root has a encrypted password.

enter image description here

If I try to connect again with the root and his password enter image description here

And I still have the same connection errror for the root user: enter image description here

If I set the same password for the user ig2, using the same syntax used to sit root's password, I can have a successful connection.

And it is weird when I try to connect trough the terminal: enter image description here

The root user can connect with or without password.

In resume, I don't know what is happening, and I don't know how to make the root to get access to the server, trough a client application like Workbench.

Does someone can explain me?

1 Answer 1

1

The answer to this question should help you out:

$ sudo mysql -u root

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

In short, the new version of MariaDB checks to see what the system user is and only allows the actual system user root to log in to the DB user root. Disabling all plugins disables that functionality.

1
  • Yes, the link you provide sent me to others links that discuss about the same subject, the anonymous connection in MariaDB. So I think there is no answer to the issue for now. I think the best option is create a new user, give it root privileges and use it as a root. It is completelly weird that I still have a Root user that can get access to the server without a password - using terminal but not client aplications. I' ve already ran a mysl_secure_instalation mariadb.com/kb/en/mariadb/mysql_secure_installation and I still can get access to the server without password.
    – IgorAlves
    Aug 11, 2016 at 13:55

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.