Heim >Datenbank >MySQL-Tutorial >局域网内连接MySQL的语句_MySQL

局域网内连接MySQL的语句_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:41:05953Durchsuche

bitsCN.com
局域网内连接MySQL的语句 我们都知道连接MySQL一般用的语句就是jdbc:mysql://localhost:3306/database,但是当你要连接到其他机器上的mysql的时候,单单把上面的语句的localhost改成对应的ip是没有用的,因为Mysql默认开放的连接权限是localhost,当你需要连接到其他机器上的时候,需要其他机器上的MySQL开启除本地以外的其他ip连接的权限。
 在局域网内连接MySQL首先要给MySQL开启远程连接的功能,在MySQL服务器上MySQL命令行执行以下命令:    Sql代码  grant all privileges on   *.* to root@"%" identified by '123' with grant option;  flush privileges;   它的意思是给从任意ip地址连接的用户名为root,密码为123的用户赋予所有的权限。其中的"%"为任意的ip地址,如果想设为特定的值也可以设定为特定的值。执行了该语句后就可以在其他机器上以root:123访问到该机器上了  作者 234390216 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