在虚拟机里安装了MySQL(CentOS6.3 + MySQL5.5.30),根据网上搜索,要想实现远程登录,需要授予权限,通过root登录mysql,然后输入
grant all privileges on *.* to ‘dev’@’localhost′ identified by '123456' with grant option;
结果显示:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
我确定我输入的root密码是正确的,因为登录时使用了密码登录
mysql -u root -p
另外,我的user表里没有user为空的记录
select user,host from mysql.user
+---
+------------+
| user | host |
+---
+------------+
| dev | % |
| root | 192.168.242.1 |
| root | localhost |
+---
+------------+