Home > Database > Mysql Tutorial > Ubuntu MySQL远程win连接不上的解决_MySQL

Ubuntu MySQL远程win连接不上的解决_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:38:27
Original
1131 people have browsed it

Ubuntu

bitsCN.com


Ubuntu MySQL远程win连接不上的解决

 

Ubuntu10.04上自带的MySQL,执行了 root@ubuntu :~#sudo apt-get install mysql 安装完mysql-server

启动mysql root@ubuntu :~#/etc/init.d/mysql start

 

本地可以连接进入数据库。 root@ubuntu :~#mysql -uroot -p

 

设置了远程访问权限: mysql> grant all PRIVILEGES on . to admin@’%’ identified by ‘123456′; Query OK, 0 rows affected (0.04 sec)

 

mysql> use information_schema mysql> select * from user_privileges; 查询到有下面的结果:'admin’@'%',说明mysql已经授权远程连接。

 

在windows下访问Ubuntu的数据库,连接不上,但是Ubuntu上安装的apache可以访问。 用iptalbes添加端口3306后也无法访问。 root@ubuntu :~# iptables -A INPUT -p tcp –dport 3306 -j ACCEPT

 

Ubuntu上查看Mysql网络连接: root@ubuntu :~# netstat -an |grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 本地端口也在监听

 

root@ubuntu :~# ufw status Firewall not loaded 本地防火墙未打开

 

后来在网上找到一个解决办法: 查看/etc/mysql/my.cnf找到bind-address才发现配置的是 127.0.0.1(bind-address=127.0.0.1),直接改为bind-address=192.168.0.xxx(本机ip),然 后再查看3306端口打开了,ok,可以正常连接了.
 

bitsCN.com
Related labels:
win
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template