1030 Unknown generic error from engine in MySQL
In this blog, I will share the steps I took to debug an error ‘ERROR 1030 (HY000): Got error 168 – ‘Unknown (generic) error from engine’ from storage engine’ while creating a table in MySQL on my lab machine.
I attempted to create a table using the following command:
mysql> CREATE TABLE `email` (
-> `email_id` varchar(50) CHARACTER SET latin1 NOT NULL,
-> `email_from` varchar(255) CHARACTER SET latin1 NOT NULL,
-> `created_at` datetime NOT NULL,
-> `sent_at` datetime DEFAULT NULL,
-> PRIMARY KEY (`email_id`),
-> KEY `idx_email_created_at` (`created_at`),
-> KEY `idx_email_sent_at` (`sent_at`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
However, I received the following error message:
ERROR 1030 (HY000): Got error 168 – ‘Unknown (generic) error from engine’ from storage engine
I verified that the disk was functional by running the df -h command, which confirmed that there was enough space on the disk.
[root@ip-172-31-82-182 test]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 564K 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 19G 9.0G 11G 48% /
/dev/xvda2 1014M 138M 877M 14% /boot
tmpfs 777M 0 777M 0% /run/user/1000
overlay 19G 9.0G 11G 48% /var/lib/docker/overlay2/3c7a3368393279a5fc542cb3d177dc541d2af40a2e5cdb1e2945d892e032c975/merged
I then turned to the error log, where I found the following error message:
tail /var/log/mysql/mysqld.log
...
2023-04-07T12:52:31.975043Z 14489 [ERROR] [MY-012592] [InnoDB] Operating system error number 13 in a file operation.
2023-04-07T12:52:31.975054Z 14489 [ERROR] [MY-012595] [InnoDB] The error means mysqld does not have the access rights to the directory.
2023-04-07T12:52:31.975063Z 14489 [ERROR] [MY-012126] [InnoDB] Cannot create file './test/email.ibd'
hmmm… I see the “[InnoDB] Cannot create file” in MySQL error log and “perror” suggests that is “Permission denied”.
[root@ip-172-31-82-182 test]# perror 13
OS error code 13: Permission denied
MySQL error code MY-000013: Can't get stat of '%s' (OS errno %d - %s)
[root@ip-172-31-82-182 test]#
1030 Unknown generic error from engine in MySQL
为者常成,行者常至
自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)