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.

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):

Completely stop XAMPP, this means stop apache, ftp and mysql

Open the program called Terminal

Type in sudo -i to become root (or do su root if the first doesn’t work for you)

You are most probably asked for a password which you have to enter while no characters are displayed

50 Comments

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

Tina

Posted January 19, 2010 at 7:52 AM

Hi, where did you change this permission?

Jeff

Posted January 26, 2010 at 3:17 PM

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!

Wim

Posted March 6, 2010 at 12:20 AM

This has been a lifesaver… Thanks so much!

Dan

Posted March 18, 2010 at 2:22 AM

Thank you so much

Tina:
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

Amit

Posted December 3, 2010 at 12:33 PM

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

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

slopjong

Posted November 10, 2011 at 1:59 PM

You’re welcome

tarique

Posted December 21, 2011 at 8:27 AM

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

Burke

Posted January 28, 2012 at 1:07 PM

You saved me with that one. Thanks!

Musewei

Posted March 7, 2012 at 8:35 AM

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

David Jung

Posted March 31, 2012 at 8:08 PM

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)

Antonio

Posted April 8, 2012 at 7:09 PM

I love U so much <3<3<3

nestor

Posted May 27, 2012 at 6:47 PM

thx you! its works!

Campbeln

Posted July 10, 2012 at 4:37 PM

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 ? .

slopjong

Posted July 10, 2012 at 5:29 PM

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.

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.

slopjong

Posted September 2, 2012 at 10:43 PM

Wow. After three years the same issue still appears.

Dennis

Posted October 6, 2012 at 8:40 PM

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

Little@Large

Posted October 6, 2012 at 8:41 PM

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

THANK YOU.

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

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:

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.

slopjong

Posted October 31, 2012 at 4:56 PM

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

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.
Cheers,

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

Andre

Posted April 21, 2013 at 4:24 PM

Worked for me on Mac, thx folks

Tony

Posted May 4, 2013 at 2:45 PM

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

contenidoneto

Posted May 11, 2013 at 4:31 PM

MIL GRACIAS, Thank you very much!

Alien

Posted June 2, 2013 at 12:02 AM

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

AndAnd

Posted June 19, 2013 at 3:23 PM

Thank you so much!

tony

Posted June 20, 2013 at 4:57 AM

It work ! great!!!thanks you !!

adreamer

Posted June 21, 2013 at 4:50 AM

that is ok! thank you 。

SandraW

Posted February 25, 2014 at 11:58 AM

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.