MYSQL Error: 13 (Permission Denied)
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.*
Solution 1:
I ran the following and it worked on Ubuntu Server 19.10:
sudo chown -R mysql:mysql /var/lib/mysql/
Solution 2:
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 .