mysql 开启远程连接

来源:互联网 发布:ug怎么编程 编辑:程序博客网 时间:2024/05/29 16:22

ubuntu下开启远程连接

一、 windows中开启权限:(注意:下面的ip地址是windows的ip,允许该ip访问数据库)

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.0.188' IDENTIFIED BY '123456' WITH GRANT OPTION;

flush privileges;


二、修改成允许所有用户访问:

1)use mysql; 
2)select user,host from user;

#将localhost修改成%
3)update user set host='%' where host='localhost'     
 


三、配置文件注释掉bind-address选项
/etc/mysql/my.cnf
注释掉里边的bind-address配置项

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1


重启mysql
service mysql restart