Contexte: mon carnet de notes a gelé et je l'ai forcé de le redémarrer. Après le redémarrage, je n'arrive pas à démarrer le serveur 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.
Ensuite:
$ 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
et:
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
Quelques journaux pertinents:
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
Que puis-je faire pour résoudre le problème?
J'ai essayé de réinstaller mysql-server
, mais cela n'a pas résolu le problème.
J'ai récupéré les données avec succès en éditant /etc/mysql/my.cnf
(en fonction de votre configuration, my.cnf
peut avoir un emplacement différent) en ajoutant:
[mysqld]
innodb_force_recovery = 1
Et puis en cours d'exécution:
Sudo systemctl start mysql
Cela n'a pas fonctionné pour la première fois et j'ai incrémenté le nombre à 2
, 3
etc, en essayant de démarrer après chaque mise à jour de la configuration. Finalement, cela a commencé.
Ensuite, je viens de commenter le code innodb_force_recovery
et tout a redémarré avec succès (certaines opérations ne sont pas autorisées en mode de récupération forcée).
Cette réponse était très utile.