操作系统:Ubuntu 11.10
MySQL版本:5.1
症状:重启服务器后,MySQL无法启动,执行sudo service mysql start花费很长时间,无错误提示。
解决:
1)查看日志:sudo cat /var/log/mysql/error.log,大致如下:
qi@site-digger:/var/log/mysql# sudo cat /var/log/mysql/error.log 130216 16:11:32 [Note] Plugin 'FEDERATED' is disabled. 130216 16:11:32 InnoDB: Initializing buffer pool, size = 8.0M 130216 16:11:32 InnoDB: Completed initialization of buffer pool 130216 16:11:33 InnoDB: Started; log sequence number 0 1382359817 130216 16:11:33 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address 130216 16:11:33 [ERROR] Do you already have another mysqld server running on port: 3306 ? 130216 16:11:33 [ERROR] Aborting 130216 16:11:33 InnoDB: Starting shutdown... 130216 16:11:38 InnoDB: Shutdown completed; log sequence number 0 1382359817 130216 16:11:38 [Note] /usr/sbin/mysqld: Shutdown complete
日志给出的原因是:可能3306端口被其它程序占用的。真是如此吗?
2)查看谁占了3306。执行sudo netstat -nat | grep 3306,但是无结果返回,说明并非是由于端口被占用了。
3)那到底是怎么回事呢???在stackovflow上发帖询问,有高人指点让查看下my.conf里的bind-address参数,查看其值为127.0.0.1。貌似也没啥问题。很困惑...
4)无意识地敲了个ifconfig,显示结果如下。顿时灵机一动,额滴神啊,谁把127.0.0.1改成127.0.0.2了??问题找到了。
qi@site-digger:~$ ifconfig venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:6072143 errors:0 dropped:0 overruns:0 frame:0 TX packets:7166117 errors:0 dropped:523 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4602064461 (4.6 GB) TX bytes:7104219611 (7.1 GB) venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:199.167.132.58 P-t-P:199.167.132.58 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
5)编辑/etc/network/interfaces,将127.0.0.2改回127.0.0.1,并执行sudo /etc/init.d/networking restart。然后再sudo service mysql restart,哦了!
呵呵,谢谢
VaTG790i.最好的<a href=http://www.kyfei.com>网站推广软件</a>,
非常好
....................
;ui;普i;uighur;ui;ui;个
在unix网络编程中看到了关于TCP/IP的一些内容,我感觉还是写的不够。正在下载中,一定
下载地址呢