[20:53][tom@Pochama:/var/www/website] (master) $ sudo service
mysql restart
start: Job failed to start
The syslog reveals there is a problem with the init script:
> tail -f /var/log/syslog
Apr 28 21:17:46 Pochama kernel: [11840.884524] type=1400 audit(1335644266.033:184): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=760 comm="apparmor_parser"
Apr 28 21:17:47 Pochama kernel: [11842.603773] init: mysql main process (764) terminated with status 7
Apr 28 21:17:47 Pochama kernel: [11842.603841] init: mysql main process ended, respawning
Apr 28 21:17:48 Pochama kernel: [11842.932462] init: mysql post-start process (765) terminated with status 1
Apr 28 21:17:48 Pochama kernel: [11842.950393] type=1400 audit(1335644268.101:185): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=811 comm="apparmor_parser"
Apr 28 21:17:49 Pochama kernel: [11844.656598] init: mysql main process (815) terminated with status 7
Apr 28 21:17:49 Pochama kernel: [11844.656665] init: mysql main process ended, respawning
Apr 28 21:17:50 Pochama kernel: [11845.004435] init: mysql post-start process (816) terminated with status 1
Apr 28 21:17:50 Pochama kernel: [11845.021777] type=1400 audit(1335644270.173:186): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=865 comm="apparmor_parser"
Apr 28 21:17:51 Pochama kernel: [11846.721982] init: mysql main process (871) terminated with status 7
Apr 28 21:17:51 Pochama kernel: [11846.722001] init: mysql respawning too fast, stop
I finally figured out the issue. Basically, the definition of
some parameters has been removed from the previous version of mysql
and has been replaced with different names. To fix, in
/etc/mysql/my.cnf, replace:
# Tom Added to ensure the server character set is set to utf8
default-character-set = utf8default-collation = utf8_general_ci
with:
# Tom Added to ensure the server character set is set to utf8
character_set_server = utf8
collation_server = utf8_general_ci
Or easily run:
# Miraz added dpkg-reconfigure
dpkg-reconfigure mysql-server-5.5
But make sure there's no old mysql version installation
installed, if there was please remove:
# Miraz quick mysql package check
dpkg -l *mysql*
本文记录了一次MySQL服务重启失败的问题排查及解决方案。故障表现为服务无法正常启动,通过查看系统日志发现与AppArmor配置有关。最终确定是因为部分参数定义变更导致,通过调整配置文件中的字符集设置解决了问题。
7万+

被折叠的 条评论
为什么被折叠?



