Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Access denied for user 'root'@'localhost' #650

Closed
netlooker opened this issue May 19, 2016 · 14 comments
Closed

Access denied for user 'root'@'localhost' #650

netlooker opened this issue May 19, 2016 · 14 comments

Comments

@netlooker
Copy link

netlooker commented May 19, 2016

After build and provisioning machine I've noticed small issue regarding connection with mysql database for root user.
I wasn't able to login via default root/root either from command line or adminer. After short investigation I found that root@localhost user is using “plugin: auth_socket”. I've changed that via following commands:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';

After this small task I'm able to login as an root. Below I'm enclosing article which is putting more light on that topic.
https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/

@geerlingguy
Copy link
Owner

Interesting... I'll take a look—this might need to be filed upstream in the geerlingguy.mysql role repository.

@hawkeyetwolf
Copy link
Contributor

Confirmed the issue and suggested temporary resolution. Thanks @netlooker!

@antonyanimator
Copy link

antonyanimator commented Jun 1, 2016

Yep I have the same problem. Thanks for the solution netlooker

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

@aleksey-tk
Copy link
Contributor

I have the same issue and also can confirm that previous comment fix the problem

@tsmith512
Copy link

👍 for the solution provided by @antonyanimator and @netlooker. Got me fixed up. Thank you.

@mixplex
Copy link

mixplex commented Jun 4, 2016

I had the same issue with the D8, PHP 7 machine. Thank you anonyanimator for the solution and netlooker for the post. Finally got me fixed up too.

@geerlingguy geerlingguy added this to the 3.1.1 milestone Jun 6, 2016
@mixplex
Copy link

mixplex commented Jun 9, 2016

I still have issues with D8 installs, getting caught denying access to root in mysql.

@tsmith512
Copy link

@mixplex , If you're having trouble with D8 installs during provisioning, I wonder if that's because the fix from this ticket has to be executed manually. Looks like the MySQL setup is actually pulled in from another repo, but maybe adding a command that would sudo mysql -e 'the command from above' in this file: https://github.com/geerlingguy/drupal-vm/blob/master/provisioning/tasks/install-site.yml at line 10 might be a temporary fix to support auto install?

@geerlingguy
Copy link
Owner

Note that if you use a mysql_users user specific to your drupal site/mysql_databases database, then automatic installation should work without worrying about the root user account.

I typically don't rely on having access to the root MySQL account (just like I don't use the root Linux account unless it's necessary), and if I need an account to access multiple databases, I'll set that in the user's access permissions.

I still want to fix this upstream, of course :)

@jestinijames
Copy link

How do i fix this on windows?

@geerlingguy
Copy link
Owner

@jestinijames - This error can be caused by a large number of different things. It could be something with Drupal VM, or Drush, or the particular Drupal codebase you're working on, or something inside settings.php, or even tools like BLT.

It would be best if you open a new issue with every detail you can provide (along with detailed console logs) so we can help you more.

@sirzorre
Copy link

I had the following error:

Unhandled rejection SequelizeConnectionError: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Which was solved using the above command:


sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';

But after having solved that error i was unable to log in to my mysql-database through adminer which i had been able to do before the above command. After having checked the database it seems all my tables are being added so it should be some sort of problem with adminer caused by this solution. Does anyone know how to fix it?

@hawkeyetwolf
Copy link
Contributor

Just to make sure, you're using the new password ("test") to log in, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants