2007年7月12日 星期四

解決外部網路無法連到 Ubuntu MySQL server 的問題

今天在 Ubuntu 上裝了 MySQL server....
當帳號密碼都設定完成後,卻發現沒辦法從外部透過 mysql 指令連入,於是下了以下指令檢查:
user@ubuntu:~$ netstat -utlnp
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -


原來只針對 127.0.0.1 作 listen,難怪外部連不進來...

而解決方法就是在 MySQL 的設定檔(在 Ubuntu 中為 /etc/mysql/my.cnf)中找到以下此行,並將其註解:
bind-address = 127.0.0.1
再次重新 MySQL 後,問題就解決囉!

沒有留言:

張貼留言