MySQL Operating system error number 13

Draft | Approver: psycore

MySQL Operating system error number 13

Problem

The start of the Mysql server fails and in the syslog the following error message is displayed:

Feb 23 19:30:50 v21080422 mysqld_safe[22878]: started
Feb 23 19:30:50 v21080422 mysqld[22881]: 100223 19:30:50  InnoDB: Operating system error number 13 in a file operation.
Feb 23 19:30:50 v21080422 mysqld[22881]: InnoDB: The error means mysqld does not have the access rights to
Feb 23 19:30:50 v21080422 mysqld[22881]: InnoDB: the directory.
Feb 23 19:30:50 v21080422 mysqld[22881]: InnoDB: File name ./ibdata1
Feb 23 19:30:50 v21080422 mysqld[22881]: InnoDB: File operation call: 'open'.
Feb 23 19:30:50 v21080422 mysqld[22881]: InnoDB: Cannot continue operation.
Feb 23 19:30:50 v21080422 mysqld_safe[22888]: ended

Solution

The problem is that the files required by MySQL have incorrect rights or incorrect user (groups). The following commands set the correct user 1).

Commands for user/group assignment

setuser-mysql.txt
chown -R mysql /var/run/mysqld
chown -R mysql /var/lib/mysql
chown -R mysql /var/log/mysql
 
chgrp -R root /var/run/mysqld
chgrp -R adm /var/lib/mysql
chgrp -R adm /var/log/mysql
1)
as an example user: mysql Group:adm / adjust accordingly to your own configuration
en/linux/mysql/error-number-13.txt ยท Last modified: 2023/11/07 16:22
CC Attribution-Noncommercial-Share Alike 4.0 International