I've read all the posts I could find about this, and none helped. I've deleted the XAMPP folder from my computer and reinstalled it from the DMG file, which of course fixed the problem, but I'd like to know how to fix it in the future.
How it all started: I was logged in to phpMyAdmin on my Macbook (which runs Mac OS X v10.7.4). I saw the message advising me to change the password of root, which by default has no password. I went to the Manage Privileges tab and changed the password for root on localhosts, webdev and 127.0.0.1. In each case, I typed in the same short password and clicked "Generate Password," which created three different hashes.
You know what comes next: When I tried to access localhost/phpmyadmin again, I was locked out with the message:
Error
MySQL said:
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
So I looked up stackoverflow, which advised me to set the password for root at the command line. I created a ".profile" file in my user directory, with "export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH" in it. That enabled me to start a mysql session, but (being a noob) I couldn't figure out what to do after that.
Stackoverflow also advised that I could change the password in config.inc.php. I found this file at phpmyadmin/setup/frames/config.inc.php, but the line
$cfg['Servers'][$i]['password'] = '';
was not in there. I did find that line in phpmyadmin/libraries/config.default.php, but that file contains dire warnings against editing it. I found another likely file, phpmyadmin/setup/lib/common.inc.php, as well as phpmyadmin/scripts/signon.php, but in all cases, my computer prevented me from making any changes, saying I didn't have permissions. So that was frustrating.
I'm sure this is a rookie mistake, or several of them, but I was curious to find that none of the things I looked up on stackoverflow helped me. I also wish the Mac OS made it easier to do things like create system files (e.g., .profile) and edit XAMPP files (e.g., common.inc.php). But what can you do.