默认状况下Linux内的mysql数据库mysql,user表内的用户权限只是对localhost即本机才能登录。须要更改权限:mysql
mysql> Grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;(%表示是全部的外部机器,若是指定某一台机,就将%改成相应的机器名;‘root’则是指要使用的用户名,)sql
mysql> flush privileges; (运行为句才生效,或者重启MySQL)数据库
Query OK, 0 rows affected (0.03 sec)ide
查看用户的权限状况:.net
mysql>use mysql;blog
mysql> select host,user from user; get
| % | root |(表面root可外部IP访问)it
Thanks: http://blog.csdn.net/shunzi19860518/article/details/5057657io