I've read many threads on SO and a few other places and haven't been able to fix my mysql installation in MAMP.
Background. I made a change to my root user the other day in an attempt to get a local service to connect properly. After rebooting my machine phpmyadmin in mamp no longer displayed any of my dbs and showed "No Privileges" to create a database. I tried many things to restore the privileges that I read here and elsewhere to no avail. --skip-grant-tables does not seem to work. Connecting as root in the shell I don't have permission as localhost but I do as 127.0.0.1.
show grants for root@localhost;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
I've installed a fresh installation of MAMP and copied over my DBs. While it works, I've run into instances where DBs are not showing all the tables.
So I have to solve one of two problems. I either have to fix the original install or make it so the all tables show for my dbs in my fresh mamp install.
Lesson learned here is don't be lazy and screw around with your root user locally and just create another login.
UPDATE When I connect as:
/Applications/MAMP/Library/bin/mysql -uroot -h127.0.0.1 -p
mysql> SHOW GRANTS FOR 'root'@'localhost';
+------------------------------------------------------------------------+
| Grants for root@localhost |
+------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `db`.* TO 'root'@'localhost' WITH GRANT OPTION |
+------------------------------------------------------------------------+
But when I connect as:
/Applications/MAMP/Library/bin/mysql -uroot -hlocalhost -p
mysql> SHOW GRANTS FOR 'root'@'localhost';
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql> SELECT user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
mysql> SELECT current_user();
+----------------+
| current_user() |
+----------------+
| @localhost |
+----------------+
So when I connect as localhost either by IP or socket I am somehow not logged in as root. I find this very confusing?