ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
grant后通过mysql -hlocalhost(或者本机IP)-uroot -p; 发现登录mysql出错,显示:
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -hlocalhost -uroot -p;
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
!!! 把 ; 去掉登录成功,即mysql -hlocalhost(或者本机IP)-uroot -p 显示输入密码,成功登录
还不行尝试再利用grant给mysql设置权限:
- 使用root用户进入mysql:mysql -uroot -p
- 输入: grant all on openfire.*to mysql@localhost identified by (‘密码’); 回车,输入 flush privileges; 回车再输入 exit; 退出mysql。(百度经验)
- 从新进入cmd,输入mysql -hlocalhost(或者本机IP)-uroot -p即可输入密码进入mysql,注意不加 ;