问题描述
vagrant@homestead:~/Code/zookeeper-3.4.9/bin$ sudo MysqL -uroot -p Enter password:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) vagrant@homestead:~/Code/zookeeper-3.4.9/bin$
这是我使用homestead用户登录进去时候查询出来的数据
MariaDB [(none)]> SELECT User, Host, Password FROM MysqL.user; +------------------+-----------+-------------------------------------------+| User | Host | Password |+------------------+-----------+-------------------------------------------+| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B || root | homestead | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 || root | 127.0.0.1 | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 || root | ::1 | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 || debian-sys-maint | localhost | *650CED166F2C5E785042D953A4BD3360FA2BA6CB || root | 0.0.0.0 | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 || homestead | 0.0.0.0 | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 || homestead | % | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 |+------------------+-----------+-------------------------------------------+8 rows in set (0.00 sec)
解决方法
用无密码尝试下,请将user表的root对应的host(localhsot)update为%,应该是MysqL的权限设置只允许本机访问。
正常这样就可以了!