mysqld:作业启动失败

mysqld:作业启动失败

操作系统:Ubuntu 12.04

命令:sudo /etc/init.d/mysqld start

偶尔 mysqld 无法启动。我没有对 my.cnf 或这台笔记本电脑上的任何其他配置进行任何更改。有一天没问题,另一天我遇到了这个错误。

syslog:
Aug 11 11:09:14 oleg-laptop kernel: [ 1915.342628] type=1400 audit(1344708554.812:75): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=5808 comm="apparmor_parser"
Aug 11 11:09:16 oleg-laptop kernel: [ 1917.039784] init: mysql main process (5812) terminated with status 1
Aug 11 11:09:16 oleg-laptop kernel: [ 1917.039816] init: mysql main process ended, respawning
Aug 11 11:09:16 oleg-laptop kernel: [ 1917.382623] init: mysql post-start process (5813) terminated with status 1
Aug 11 11:09:16 oleg-laptop kernel: [ 1917.396212] type=1400 audit(1344708556.868:76): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=5859 comm="apparmor_parser"
Aug 11 11:09:18 oleg-laptop kernel: [ 1918.981751] init: mysql main process (5863) terminated with status 1
Aug 11 11:09:18 oleg-laptop kernel: [ 1918.981774] init: mysql main process ended, respawning
Aug 11 11:09:18 oleg-laptop kernel: [ 1919.436244] init: mysql post-start process (5864) terminated with status 1
Aug 11 11:09:18 oleg-laptop kernel: [ 1919.455425] type=1400 audit(1344708558.928:77): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=5910 comm="apparmor_parser"
Aug 11 11:09:20 oleg-laptop kernel: [ 1921.155101] init: mysql main process (5914) terminated with status 1
Aug 11 11:09:20 oleg-laptop kernel: [ 1921.155165] init: mysql respawning too fast, stopped

/var/log/mysql.err 和 mysql.log 是空的。

有什么线索吗?

更新:

当手动启动守护进程时,我有有趣的输出:

Command: sudo -u mysql mysqld
....
120811 11:28:19 [Note] Server hostname (bind-address): '192.168.1.3'; port: 3306
120811 11:28:19 [Note]   - **'192.168.1.3' resolves to '192.168.1.3'**;
120811 11:28:19 [Note] **Server socket created on IP: '192.168.1.3'**.
120811 11:28:19 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
120811 11:28:19 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120811 11:28:19 [ERROR] Aborting

Command: ifconfig
...
wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          **inet addr:192.168.1.2**  Bcast:192.168.1.255  Mask:255.255.255.0

这意味着 mysql 尝试绑定到 192.168.1.3,而实际 IP 地址是 192.168.1.2。知道为什么会发生这种情况吗?笔记本电脑已连接到 Wi-Fi DHCP 网络。

答案1

尝试以下任何一种方法:

  • 尝试禁用 aparmor
  • 尝试重新安装 mysql 或者其他解决方案在这个网址中提到:

https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.1/+bug/573318

答案2

好的,这是这个问题的解决方案:

在 my.cnf 文件中有一行:

bind-address = 192.168.1.3

将其更改为

bind-address = localhost

Mysql 正常启动。我很确定我没有手动将 IP 地址放在那里,所以它是由 mysql 自己添加的。那么,要小心使用 mysql 和 DHCP。

相关内容