7

I am getting *Job for mysql.service failed because the control process exited with error code.

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

When I run that command I get

● 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.*
5
  • 1
    mysql has no permission accessing its files, check user permissions in /var/lib/mysql/ – pLumo Apr 20 '20 at 14:40
  • who should own the files? – Nate Apr 20 '20 at 14:42
  • 1
    The same user that mysql is running on. I guess mysql ?! – pLumo Apr 20 '20 at 14:45
  • Thank you that worked. I ran chown -R mysql:mysql /var/lib/mysql/ – Nate Apr 20 '20 at 14:53
  • Thank you to askubuntu.com/users/631600/plumo for helping me. – Nate Apr 20 '20 at 14:58
6

I ran the following and it worked on Ubuntu Server 19.10:

sudo chown -R mysql:mysql /var/lib/mysql/
1
  • 2
    Please provide more details in your answer so that it is self-standing. Just the command is not sufficient. – user68186 Apr 20 '20 at 15:29
1

You can logging to the /var/log/mysqld path and check the mysql error.

tail -f /var/log/mysqld.log

Then you can see the permission error path. Example as below.

"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)"

Now you can give access permission to above path using below command:

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

After that, try to start mysqld service .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.