Home > Database > Mysql Tutorial > body text

局域网内连接MySQL的语句_MySQL

WBOY
Release: 2016-06-01 13:41:05
Original
893 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!