Can't access MySQL databases after upgrade to Mountain Lion (using MAMP)

梦想与她 提交于 2019-12-12 23:04:34

问题


I recently upgraded to Mountain Lion from Snow Leopard, and in doing so threw my entire local development environment into disarray. I solved the majority of my issues by finally installing MAMP Pro (I was previously using the "native" methods provided by Apple). The problem I have now is I still can't access my old mysql databases. I can view the "new" databases via phpmyadmin in MAMP, but I have old projects that I'd like to work on.

My old databases still exist in /usr/local/mysql/data, but they don't appear in phpmyadmin or even if I query via Terminal (after logging in to mysql & using the show databases; command). I'm sure the answer involves just a few simple commands, but I'm mainly a front-end guy, and I can't for the life of me find the solution on the internets.

Thanks.

UPDATE:

Just a reference for anyone else who might have this issue (or something similar). In order to do the dump, I ended up having to turn off MAMP's instance of MySQL, and starting up the old version (through System Preferences). Otherwise I was getting 1049 errors ("unknown database"), I suppose since it was looking at the new databases instead? Really out of my element here, if you can't tell...

Either way, now it looks like it actually doesn't matter if the MAMP version is active or not. Maybe I just needed to restart all instances of MySQL? Seriously, no clue, but all is good now...


回答1:


Try this in terminal to dump old databases (replacing [text]):

/usr/local/mysql/bin/mysqldump -u root -p[pass] [db] > [filename].sql

Once you have the sql file you can import it back in with PHPMyAdmin within MAMP.



来源:https://stackoverflow.com/questions/12079298/cant-access-mysql-databases-after-upgrade-to-mountain-lion-using-mamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!