Houston, I can’t write to file

MySQL error

Today I noticed that phpMyAdmin did not work anymore. I got the message

#1 - Can't create/write to file /var/.../#sql1f7_8_0.MYI (Errcode: 13)"

Of course that file cannot be created or written because the path doesn’t exist. On my Mac computer I checked the error log file located in /Applications/XAMPP/xamppfiles/var/mysql. In my case the file was named Macintosh-2.local.err with the following content.

090831 13:44:29 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored
090831 13:44:29 [Warning] Setting lower_case_table_names=2 because file system for /Applications/XAMPP/xamppfiles/var/mysql/ is case insensitive
090831 13:44:29 [Note] Plugin 'FEDERATED' is disabled.
/Applications/XAMPP/xamppfiles/sbin/mysqld: Can't create/write to file '/var/folders/6d/6dZ2SlEKFYyfGT+0WE9rBU+++TI/-Tmp-/ibXm32k6' (Errcode: 13)
090831 13:44:29  InnoDB: Error: unable to create temporary file; errno: 13
090831 13:44:29 [ERROR] Plugin 'InnoDB' init function returned error.
090831 13:44:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
090831 13:44:29 [Note] Event Scheduler: Loaded 0 events
090831 13:44:29 [Note] /Applications/XAMPP/xamppfiles/sbin/mysqld: ready for connections.
Version: '5.1.37'  socket: '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'  port: 3306  Source distribution

Line 2 says that the config file my.cnf was ignored. In Windows you might have to look for my.ini. The result of my google research was that the file permissions must be 600.

So become root with sudo -i and fix the file permissions as follows

chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf

Finally restart your server.

Update (Februaray 19th, 2013)

Some people report that the proposed solution didn’t work for them and claim a wrong order.

First of all when working with a shell some basic understanding of how file permissions and other things work is helpful.

In fact the order of stopping a service and changing file permissions should not matter, only requirement is to restart it whenever configuration files including their file permissions change. Though nowadays Mac OS might do things hidden to the user but it didn’t when this article was written.

It’s also hardly imaginable that XAMPP reverts changes of file permissions while it’s still running, this just doesn’t make sense.

To repeat in detail what’s already said (for those who lack *nix basics):

  1. Completely stop XAMPP, this means stop apache, ftp and mysql
  2. Open the program called Terminal
  3. Type in sudo -i to become root (or do su root if the first doesn’t work for you)
  4. You are most probably asked for a password which you have to enter while no characters are displayed
  5. Execute chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf
  6. Exit your root shell with exit or just close Terminal
  7. Restart XAMPP (apache, ftp and mysql)


  1. Julien

    Great !
    It saved us, we’re trying to setup XAMPP and we get so much access rights errors !
    Nevertheless it should be more explicit !

  2. Tina

    Hi, where did you change this permission?

  3. Jeff

    Thank you! I’ve been pouring through tons of on-line advice on this same problem. Some had me changing permissions to 777 throughout, others had me add lines to the config file, etc. Your advice is the one that worked! What an obscure fix! How did you ever determine that the permissions for my.cnf had to be 0600?

    Thanks again!

  4. Wim

    This has been a lifesaver… Thanks so much!

  5. Dan

    Thank you so much

    open terminal and navigate to the folder with my.cnf
    type: sudo chmod 600 my.cnf

    hit enter then input your password. Restart mysql and you are good to go :)

  6. Amit

    still not working after set permission 600.. and after it checked with 777.. not working

  7. Yesss, It works :)

  8. Don

    Yes! Thank you. I spent a lot of time trying to figure out why InnoDb kept choking.

    I think this is finally the solution I’ve been looking for.

  9. Thanks SO much. I can’t even begin to tell you how many hours I spent on this issue… you’re a lifesaver!

  10. hiroshi

    Thx a lot Dan!

  11. markster

    Great, I changed my password on the Mac OS account and the XAMPP install went belly up!!!
    your suggestion worked a treat.

  12. Thank you a billion time, just followed what you have posted and right now it is working. :)

  13. slopjong

    You’re welcome :-)

  14. tarique

    Thanks a lot. It at least saved my 6 hours. Great post!

  15. Burke

    You saved me with that one. Thanks!

  16. Musewei

    Gee!!! It’s really helpful!!!
    I have almost tried every solution posted on elsewhere for almost one day!
    Thanks for your help!

  17. David Jung

    it worked! Thank you Thank you! (also, thank you Dan for the sudo command. This is my first time using a mac and the terminal was foreign to me)

  18. Antonio

    I love U so much <3<3<3

  19. nestor

    thx you! its works!

  20. Campbeln

    chmod on my.cnf didn’t work for me, but sudo chmod 777 /var/folders/... on the temp folders did! So that may work for you if you’re getting this error as I was. And as they are temp folders a 777 should’t be horrible (right ? ;) .

  21. slopjong

    Maybe something has changed in XAMPP in the meantime or the fix doesn’t work in all linux distributions or windows versions. I’ll check it in Arch Linux as soon as I’ve got some spare time.

  22. Thank you!

  23. I’m astounded

    I just ran into this problem and finally a few searches brought me here. Thankfully setting the filemode to 600 did the trick.

    It’s arcane and obscure. Why would such a thing not be fixed! Man. Thank goodness for users who take the time to figure it and share it with the world. Thanks very much and poo on whomever is responsible for this defect in the software.

  24. slopjong

    Wow. After three years the same issue still appears.

  25. Dennis

    Man, thanks so much. The exact same error still exists (on Mac here) in october :) Your solution fixed it :D

  26. Little@Large

    Brilliant – this worked! I have been trying to fix this for 8 hours today. And finally it’s fixed.


    For anyone who get ‘permission denied’ when following Dan’s steps above, this is what I did (Mac OS X):

    1) type ‘sudo’ (then type password, which won’t show on screen)

    2) type ‘chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf’

    Thank you!!

  27. None of these techniques worked for me since they were in some sort of wrong order, and I saw a lot of “permission denied”, “command not found” and “directory doesn’t exist”, and it made me want to kill something. Here is what i typed into terminal and it worked for me:

    Bernard-Myburghs-MacBook-Pro:~ bernardmyburgh$ sudo chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf

    So, STOP your xampp application from running end apache and mysql and ftp, THEN you open terminal, type in “sudo chmod 600″ (not the inverted commas but the words between them, so just sudo chmod 600)
    THEN go to the my.cnf folder which is in /applications/xampp/xamppfiles/etc/my.cnf and drag the file into terminal and it should simply paste the file path OR simply type it out like it is above here (both methods work the same).
    THEN press enter (return) on your keyboard and then it will either just go through without asking for your password, or another line of code will pop up asking for your password.
    THEN type it out (it wont show up in terminal) adn press enter. then it will look like nothing’s happened. then go check and phpmyadmin should be working.

  28. slopjong

    sudo chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf was essentially what the article stated and what was confirmed by the comments.

  29. Wow…what an easy fix for a major headache. Thanks!

  30. Marc

    I don’t comment much on blogs but you just saved my life with this trick. I would never have guessed that. Thanks!

  31. slopjong

    Great that I could make you happy :-)

  32. yes, that works for me….. tks for all of you

  33. Paulo

    Thanks a lot lot lot. It at least saved my LOT hours

    In my case the Bernard post help me

  34. lush

    thank you so much!! :)

  35. Thanks for all man!!!

  36. Webdesigner506

    Guys, I was able to solve the issue with the steps above. However I found my solution and it might work for someone else:
    You have to give 777 permision to the temp directory.
    -cd to xamppfiles
    - sudo chmod 777 temp
    - restart mysql
    Hope it helps someone else too.

  37. Arie Wegener

    Thanks heaps mate! Cheers from Holland.

  38. slopjong

    You’re welcome.

  39. Thank you very much!

    Bernard’s solution posted on October 31, 2012 at 2:49 PM is best!

  40. slopjong

    @Artur: I’ve edited your comment because the copy & paste of Bernard’s comment made your reply less readable.

  41. Thanks, man!

    This was pissing me off for a while… I knew that giving a 777 permission for the exact folder inside /vaf/folders was the wrong solution, but I was too lazy to look for the correct fix. But your solution worked perfectly ;-)

  42. Andre

    Worked for me on Mac, thx folks ;)

  43. Tony

    Mate, you are a CHAMPION! Spent 5 hours trying to fix this and then stumbled on your solution. Worked like magic. Thanks heaps!!!!!!

  44. contenidoneto

    MIL GRACIAS, Thank you very much!

  45. Alien

    It’s magic .. your the boss sincerely spent hours to fix that and whe i was going to switch to MAMP, found this and it worked ! a lot of love from France dude :D

  46. AndAnd

    Thank you so much!

  47. tony

    It work ! great!!!thanks you !!

  48. adreamer

    that is ok! thank you 。

  49. SandraW

    This solution worked perfectly for me – MacBookPro – Lion
    My symptoms were that my categories were not working right on my local wordpress site. Went to check my phpmyadmin …. same error as above.

  50. Charly T.

    De verdad te agradezco mucho la ayuda, estaba desesperada y haz resuelto mi problema a la perfección.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>