Heim >Datenbank >MySQL-Tutorial >mysql 用localhost能连用IP不能连_MySQL

mysql 用localhost能连用IP不能连_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:44:221172Durchsuche

bitsCN.com

 

今天犯了一个非常低级的错误:MySQL 可以用localhost 连接,但不能用IP连接

 

 

 

结果原因是忘记了给数据库授权。用grant命令在MySQL的命令行控制台中处理一下就可以了。

 

 

 

grant all privileges on *.* to '用户名'@'IP地址' identified by '密码';

 

all privileges 所有权限 也可以写成select ,update等

*.* 所有库的所有表 如databasename.*

用户名 随便起

IP  数据库所在的IP

identified by ‘密码’ 表示通过密码连接

 

 

 

执行完上述命令后用下面的命令刷新一下权限

 

flush privileges;

 

作者cooler1217

bitsCN.com
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn