Mysql – Percona startup fails: thesql can’t access directory for file creation

MySQLperconapermissions

I found a few questions and suggestions for similiar problem, unfortunately nothing seems to work for me, so please excuse me if this is double (and point to right source)…

Server is Fedora Beefy Miracle, percona mysql server installed. I do not know much about installation, I came long after initial setup. Now database services do not work.

Percona startup:

# service percona start
Starting MySQL (Percona Server). ERROR! The server quit without updating PID file (/home/percona/data/example.domain.pid).

MySQL config:

There is quite verbose my.cnf in /home/percona (which links to percona install dir) that points to datadir at /home/percona/data. In /etc/ config there is:

# cat /etc/my.cnf    
[mysqld]
datadir=/var/lib/mysql
(...)
[mysqld_safe]
log-error=/var/log/mysqld.log

I do not know for sure if this config is in use, and how mysql is called: I'm new to Percona and the setup was done by someone else. However, the log file is updated at each Percona service (attempted) start with following error:

# tail /var/log/mysqld.log
140814  0:55:18  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

This error seems common, although googled discussions usually mention 'open' mode instead of 'create'. Also, I do not know in what directory the file should be created. Files with this name exist in /var/lib/mysql/ and /home/percona/data/

Checked and tried so far:

  • setting recursively owner of /home/percona to percona:mysql, mysql:mysql and back to normal percona:percona;
  • setting recursively owner of /var/lib/mysql to mysql:percona, percona:percona and back to normal mysql:mysql; Both these users exist in the system.
  • permissions for existing ibdata1 files in both directories are 660
  • tried setting rights for ib* files in both directories, and directories itself, to 777 temporarily (to check which user would access / modify / create files – nothing happened, nothing changed;
  • advised somewhere 'mysql_upgrade' yields:

    # mysql_upgrade 
    Looking for 'mysql' as: mysql
    Looking for 'mysqlcheck' as: mysqlcheck
    FATAL ERROR: Upgrade failed
    

    (mysqlcheck ran from console shows some output, no error indication).

  • I'm afraid to run mysql_install_db because I am not sure what would be lost or overwritten in the process – there were databases running previously on the machine and I'm fairly sure I don't understand the config fully.

What should I try next, or what am I missing?

Best Answer

It sounds to me like something in your paths is incorrect. The reason most of the posts you find being about "open" are because most of the time it's a permissions issue, but the paths are correct. When you see errors about "create" it's because (generally) the path that my.conf is telling the service to find the files does not contain them.

Find any of these:

nnodb_data_home_dir = 
innodb_log_group_home_dir = 
innodb_log_arch_dir = 

Then validate the paths supplied are correct. My best guess is, they aren't. If that's the issue, after you've fixed them of you have any open permissions issues you can run:

chown -R mysql:mysql /path/to/data