mysql access possible through cmder but not through adminer
Issue Type
- Bug Report / Support Request
Your Environment
virtual box 5.1.22r115126
Vagrant 1.9.5
ansible 2.3.1.0
Your OS
Windows 10 Enterprise Edition
Summary
So one of the problems I have been having for the longest time is that I can't login to my server through adminer. Since this is a default setup I haven't changed anything.
System: mySQL Server: local8 Username: root Password: root
Result: Access denied for user 'root'@'localhost' (using password: NO)
There are two ways I can access the server through command line:
-
On cmder, i just start the virtual machine using vagrant ssh. vagrant@local8:/var/www/cgi/docroot$ vagrant@local8:/var/www/cgi/docroot$ mysql -u root -h local8 -p Enter password: root mysql> When I run the above code, it asks for password, and I type 'root' and i get access to mysql
-
The second way is through putty. I connect to the vagrant_ip: 192.168.25.8 mentioned in the config file. i input the following commands. login as: vagrant [email protected]'s password: vagrant vagrant@local8:/var/www/cgi/docroot$ mysql -u root -h local8 -p: root Enter password: root mysql>
Same thing happens as the above
Could you help me figure this out please?
I cant login with root through adminer either actually, never tried logging in as root though. It works with user configured in the config.yml:
Username: drupal Password: drupal
That user should be sufficient.
I'm guessing it has something to do with adminer and the default root user permissions—the user might only be usable on localhost through unix socket, or 127.0.0.1 locally.
But what @oxyc suggested is best—if at all possible, you should use a non-root user to do work with databases (and you can create additional users and databases by adding them to the mysql_users list in your config.yml, then running vagrant provision again).
I usually use Sequel Pro (Mac only, but like MySQL Workbench) to connect to my databases, and it works through SSH to connect as the root user; it seems only Adminer is the issue here, but I'm not sure whether we should try figuring out a fix, or close the issue as it has a couple workarounds...
Noticed this in /var/log/mysql.err
170627 13:25:48 [Warning] 'user' entry 'root@localhost' has both a password and an authentication plugin specified. The password will be ignored.
MariaDB [(none)]> use mysql;
MariaDB [mysql]> select User, plugin from user;
+-----------+-------------+
| User | plugin |
+-----------+-------------+
| root | unix_socket |
| drupal | |
+-----------+-------------+
2 rows in set (0.00 sec)
https://superuser.com/a/1129234/143294
@geerlingguy , thanks for the help, but before you close the issue could you give me a sample code for:
But what @oxyc suggested is best—if at all possible, you should use a non-root user to do work with databases (and you can create additional users and databases by adding them to the mysql_users list in your config.yml, then running vagrant provision again).
Here's an example with multiple databases and users for multisite: https://github.com/geerlingguy/drupal-vm/issues/1266#issuecomment-289646498
Or if you want the same user to have access to multiple databases: https://github.com/geerlingguy/drupal-vm/issues/826#issuecomment-235318483
@geerlingguy what do you think about https://github.com/geerlingguy/drupal-vm/issues/1452#issuecomment-311392153? This can be ignored right? It's just part of how MySQL is initially provisioned. The authentication plugin should be kept as is for sure.
I think we can close this ticket now.