Chinaunix首页 | 论坛 | 博客
  • 博客访问: 317824
  • 博文数量: 96
  • 博客积分: 230
  • 博客等级: 二等列兵
  • 技术积分: 722
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-13 22:25
个人简介

心安处即吾乡!

文章分类

全部博文(96)

文章存档

2016年(1)

2014年(79)

2013年(7)

2012年(9)

我的朋友

分类: Mysql/postgreSQL

2014-04-17 20:35:03

mysql数据库默认情况下不允许远程连接。如需设置,方法如下:
1.改表法
本地登入mysql,更改“mysql”数据库里的“user”表中的“host”项,改为"%"则允许任何主机远程连接,改为“指定IP”则仅允许该IP远程连接。
mysql -u root -p123456 -h localhost
use mysql;
update user set host = '%' where user = 'root'
2.授权法
例1.你想myuser使用mypassword从任何主机连接到mysql服务器
grant all privileges on *.* to 'myuser'@'%' identified by 'mypassword' with grant option;
例2.允许用户myuser使用mypassword从ip为192.168.1.5的主机连接到mysql服务器
grant all privileges on *.* to 'myuser'@192.168.1.5 identified by 'mypassword' with grant option;
阅读(942) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~