Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 648 Bytes

20170212_开启mysql远程登录.md

File metadata and controls

25 lines (15 loc) · 648 Bytes

开启mysql远程登录

首先访问本机的mysql(用ssh登录终端,输入如下命令):

mysql -uroot -p

输入密码登陆进去后,输入如下的语句:

use mysql;
grant all privileges on *.* to 'user'@'%' identified by 'password' with grant option;

其中:

user是用户名 mysql默认的是root password是密码自己设置 %表示任意主机,也可以指定ip地址

这样就允许远程任意一台主机访问了。

示例:

grant all privileges on *.* to 'root'@'192.168.1.100' identified by '' with grant option;

即:允许192.168.1.100以root用户无密码登录。