I am trying to partition my tables by RANGE with the following command:

ALTER TABLE  main_table
     PARTITION old_db VALUES Less Than (TO_DAYS('2021-01-01'))
       DATA DIRECTORY = "/target/directory/",

I am able to do so with the same command and data table on my laptop but I hit this error on the server: ERROR 1005 (HY000): Can't create table test.main_table (errno: 168 "Unknown (generic) error from engine")

I sudo chown the external directory to "mysql" and restarted the mysql service and I am still getting this error.

Anybody have any ideas on how to solve this? Thanks!

This is the docs I am following: https://mariadb.com/kb/en/partitions-files/

My server DB version is on: 10.3.31-MariaDB

  • Are there any interesting messages in the MariaDB error log? Is the partition engine enabled?
    – mustaccio
    Aug 12, 2021 at 12:22
  • Hi Mustaccio, thanks for responding. I checked INFORMATION_SCHEMA.PLUGINS and the partition engine is enabled and active.
    – WAX
    Aug 12, 2021 at 12:27
  • Indeed, there is something interesting on the mariaDB error logs: [ERROR] InnoDB: Operating system error number 13 in a file operation. [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. this is weird, given that I have already sudo chown the target directory to mysql: drwxr-xr-x. 2 mysql mysql 6 Aug 12 xx:xx mysql_p
    – WAX
    Aug 12, 2021 at 12:28
  • Thanks @mustaccio for pointing me in the right direction. I realised one of the security policy was blocking mysqld from creating the mysql directories
    – WAX
    Aug 12, 2021 at 13:53

1 Answer 1


Realised one of my server's security policy was blocking mysqld from creating the mysql directories. Resolved

Update: OS version: Linux RHEL 7.4. I realised it was SELinux which was blocking the mysqld after each system reboot. I followed this post to test it out and configure SELinux to 'whitelist' mysqld - https://blogs.oracle.com/mysql/selinux-and-mysql-v2

  • Please add more clues -- which OS? What command was used to 'fix' the problem?
    – Rick James
    Aug 12, 2021 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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