两台电脑的数据库如何互相访问?

有两台电脑(192.168.1.3,192.168.1.2)(相当于局域网里的电脑)

在192.168.1.3上

1.安装MySQL服务,

2.安装navicat

3.grant select,delete,update,insert on abc.* to 'root'@'192.168.1.2' identified by 'root';

(abc是数据库,root是用户名,密码)

 

这样在192.168.1.2机子上可以访问了;

 

注明:两台电脑在家都用网线连上的(右击本地连接ip为192.168.1.3,子网掩码为192.168.1.2确定即可);

 

 

Grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;(%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名;‘root’则是指要使用的用户名,)

 

 

 

 

mysql> flush privileges;  (运行为句才生效,或者重启MySQL)

 

 

grant all on *.* to dba@’localhost’

posted @ 2017-04-01 09:32  单枪匹马VIP  阅读(1739)  评论(0编辑  收藏  举报