9 votes

Erreur MYSQL : 13 (Permission refusée)

Je reçois *Job for mysql.service failed because the control process exited with error code.

See "systemctl status mysql.service" and "journalctl -xe" for details.* 

Quand je lance cette commande, j'obtiens

 mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-04-20 09:32:04 CDT; 19s ago
  Process: 7287 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
  Process: 7295 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
 Main PID: 7295 (code=exited, status=1/FAILURE)
   Status: "Server startup in progress"
    Error: 13 (Permission denied)

Apr 20 09:32:04 sturtz.ml systemd[1]: mysql.service: Service RestartSec=100ms expired, scheduling restart.
Apr 20 09:32:04 sturtz.ml systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Apr 20 09:32:04 sturtz.ml systemd[1]: Stopped MySQL Community Server.
Apr 20 09:32:04 sturtz.ml systemd[1]: mysql.service: Start request repeated too quickly.
Apr 20 09:32:04 sturtz.ml systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 20 09:32:04 sturtz.ml systemd[1]: Failed to start MySQL Community Server.*

9voto

user1033619 Points 192

J'ai exécuté ce qui suit et cela a fonctionné sur le serveur Ubuntu 19.10 :

sudo chown -R mysql:mysql /var/lib/mysql/

2voto

ImeshRandy Points 21

Vous pouvez vous connecter à la /var/log/mysqld et vérifiez le mysql erreur.

tail -f /var/log/mysqld.log

Ensuite, vous pouvez voir le chemin de l'erreur de permission. Exemple ci-dessous.

"2021-01-13T04:46:06.336009Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000001 - Can't create/write to file '**/var/run/mysqld/mysqld.pid**' (OS errno 13 - Permission denied)"

Maintenant vous pouvez donner la permission d'accès au chemin ci-dessus en utilisant la commande ci-dessous :

chown -R mysql:mysql /var/run/mysqld/

Après cela, essayez de démarrer mysqld service .

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X