背景:我的笔记本死机了,我强行重新启动它。重启后,我似乎无法启动mysql服务器。
$ sudo systemctl start mysql
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
然后:
$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Wed 2018-02-21 10:15:57 EET; 22s ago
Process: 8611 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
Process: 8605 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 8611 (code=exited, status=2); Control PID: 8612 (mysql-systemd-s)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/mysql.service
└─control
├─8612 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─9459 sleep 1
feb 21 10:15:57 notebook systemd[1]: Starting MySQL Community Server...
feb 21 10:15:57 notebook systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
和:
feb 21 10:15:57 notebook audit[8611]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8611/status" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:15:57 notebook audit[8611]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=0
feb 21 10:15:57 notebook audit[8611]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8611/status" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:15:57 notebook kernel: audit: type=1400 audit(1519200957.179:123): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8611/status" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:15:57 notebook kernel: audit: type=1400 audit(1519200957.179:124): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=0
feb 21 10:15:57 notebook kernel: audit: type=1400 audit(1519200957.179:125): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/8611/status" pid=8611 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:15:57 notebook systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
feb 21 10:16:23 notebook unity-scope-hom[10534]: scope.vala:247: Failed to get list of remote scopes: Request failed with error 2
feb 21 10:16:27 notebook systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is failed.
feb 21 10:16:27 notebook systemd[1]: mysql.service: Unit entered failed state.
feb 21 10:16:27 notebook systemd[1]: mysql.service: Failed with result 'exit-code'.
feb 21 10:16:27 notebook systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
feb 21 10:16:27 notebook systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
feb 21 10:16:27 notebook systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
feb 21 10:16:27 notebook audit[9495]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9495/status" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:16:27 notebook audit[9495]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=0
feb 21 10:16:27 notebook audit[9495]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9495/status" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:16:27 notebook kernel: audit: type=1400 audit(1519200987.677:126): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9495/status" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:16:27 notebook kernel: audit: type=1400 audit(1519200987.677:127): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=0
feb 21 10:16:27 notebook kernel: audit: type=1400 audit(1519200987.677:128): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9495/status" pid=9495 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=128 ouid=128
feb 21 10:16:27 notebook systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
一些相关日志:
2018-02-21T08:05:30.279927Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-02-21T08:05:30.289022Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-02-21T08:05:30.292279Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-02-21T08:05:30.314528Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-02-21T08:05:30.318295Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 82335887334
2018-02-21T08:05:30.318321Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 82335916567
2018-02-21T08:05:30.324853Z 0 [Note] InnoDB: Database was not shutdown normally!
2018-02-21T08:05:30.324866Z 0 [Note] InnoDB: Starting crash recovery.
2018-02-21T08:05:30.411651Z 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page [page id: space=0, page number=1579]. You may have to recover from a backup.
2018-02-21T08:05:30.411674Z 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex 43a34cfa0000062b0000000000000000000000132b99dd12000200000000000000000000000000010110011dffffffff0000ffffffff00000002005600000000000002cf2bb2000000010000062b002c0000062b002c000000000d552a9600000000000000000001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011d0b00824b048bc5686801106731546d78726f496b676a424d4f66634b497762496d4c36795401100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
我能做些什么来解决这个问题?
我尝试重新安装mysql-server
,但这并没有解决问题。
/etc/mysql/my.cnf
我通过编辑(取决于您的配置,my.cnf
可能有不同的位置)通过添加以下内容成功恢复了数据:然后运行:
它第一次不起作用,我将数字增加到
2
等3
,在每次配置更新后重试启动。终于开始了。然后我只是把这些
innodb_force_recovery
东西注释掉了,它重新启动成功(强制恢复模式下不允许某些操作)。这个答案非常有帮助。
我尝试了上面写的所有东西,但是直到我敢于尝试下一个基于相反想法的东西之前,我都没有任何效果
/etc/mysql/mysql.conf.d/mysqld.cnf
当您的文件设置错误时会出现此问题。如果您最近对此文件进行了更改,请恢复到以前的文件或从此处复制默认文件