MySQL : Error :1004 SQLSTATE: HY000 (ER_CANT_CREATE_FILE) Can't create file

Error No : 1004
Error Type : Server Error
Error Message : Can't create file '%s' (errno: %d - %s) Server Error
This error may occur when creating a .frm file or copying it from one location to another fails.

If the .frm file is being moved or you do not have access permissions then you may get ER_CANT_CREATE_FILE.

It may also occur during creating of new table using LIKE clause.

What is a .frm file?
  1. MySQL table that you create are stored with .frm file extension in the disk.
  2. The file has the same name as that of the table you create.
  3. The file format is the same regardless of the platform.
Example to access .frm file (Using XAMPP)
  1. Create table : mydb.mytable (name varchar(10));
  2. Now go to location where mysql is installed : XAMPP/xamppfiles/var/mysql/mydb/mytable.frm
  3. Note you may not have access to this file only if you have root access.
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -