您的位置:首页 > 数据库 > MySQL

远程连接ubuntu下的mysql

2010-03-29 16:31 399 查看
一.问题:远程无法连接服务器ubuntu上的mysql

二.解决方法:

1.ubuntu登陆msql,创建一个可以使远程连接的 MySQL 用户, 用户名:admin,密码:admin
mysql>GRANT ALL PRIVILEGES ON *.* TO admin@"%" IDENTIFIED BY 'admin' WITH GRANT OPTION;

2.修改mysql的配置文件 /etc/mysql/my.cnf

找到

# 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



bind-address = 127.0.0.1 这一行注释掉,即改为

#bind-address = 127.0.0.1
3.重启mysql

sudo /etc/init.d/mysql restart

这样就可以使用 用户名:admin,密码:admin 远程连接数据库了
测试方法:mysql -h ubuntu的ip -u admin -p admin
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: