Access denied for user 'root'@'localhost'
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/
Interesting... I'll take a look—this might need to be filed upstream in the geerlingguy.mysql role repository.
Confirmed the issue and suggested temporary resolution. Thanks @netlooker!
Yep I have the same problem. Thanks for the solution netlooker
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
I have the same issue and also can confirm that previous comment fix the problem
:+1: for the solution provided by @antonyanimator and @netlooker. Got me fixed up. Thank you.
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.
I still have issues with D8 installs, getting caught denying access to root in mysql.
@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?
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 :)
Related:
- https://github.com/ansible/ansible-modules-core/issues/3003
- http://dev.mysql.com/doc/refman/5.7/en/default-privileges.html
How do i fix this on windows?
@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.
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?
Just to make sure, you're using the new password ("test") to log in, right?