码迷,mamicode.com
首页 > 数据库 > 详细

Mysql 远程登陆配置

时间:2016-03-16 01:49:20      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:mysql 远程登陆配置

1.修改localhost
更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改成"%"  远程只允许root 登陆
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;  
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES;

2、指定授权
使用myuser/mypassword从任何主机连接到mysql服务器:
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

使用myuser/mypassword从ip为192.168.31.87的主机连接到mysql服务器:
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.31.87‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

3、泛授权
mysql -h localhost -u root
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ WITH GRANT OPTION;                     //赋予任何主机上以root身份访问数据的权限
mysql>FLUSH PRIVILEGES;


本文出自 “为梦想奋斗” 博客,谢绝转载!

Mysql 远程登陆配置

标签:mysql 远程登陆配置

原文地址:http://hanzheng.blog.51cto.com/3080616/1751298

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!