升级到Mountain Lion后(使用MAMP)无法访问MySQL数据库 [英] Can't access MySQL databases after upgrade to Mountain Lion (using MAMP)

查看:97
本文介绍了升级到Mountain Lion后(使用MAMP)无法访问MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从Snow Leopard升级到Mountain Lion,这样做使整个本地开发环境陷入混乱.我最终安装了MAMP Pro,解决了大部分问题(我以前使用的是Apple提供的本机"方法).我现在遇到的问题是我仍然无法访问旧的mysql数据库.我可以通过MAMP中的phpmyadmin查看新"数据库,但我有一些旧项目需要处理.

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.

我的旧数据库仍然存在于/usr/local/mysql/data中,但是即使我通过终端查询(使用show databases;命令登录到mysql&之后),它们也不会出现在phpmyadmin中.我敢肯定,答案只涉及几个简单的命令,但我主要是前端人员,我一生无法在互联网上找到解决方案.

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.

谢谢.

仅供其他可能遇到此问题(或类似问题)的人参考.为了进行转储,我最终不得不关闭MAMP的MySQL实例,并启动旧版本(通过系统偏好设置").否则,我想会收到1049错误(未知数据库"),因为它正在查看新数据库?如果您不能告诉我,这真的超出了我的理解范围

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

无论哪种方式,现在看来MAMP版本是否处于活动状态实际上都无关紧要.也许我只需要重新启动所有MySQL实例?严重的是,没有任何线索,但是现在一切都很好了.

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

推荐答案

在终端中尝试此操作以转储旧数据库(替换[text]):

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

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

一旦有了sql文件,就可以使用MAMP中的PHPMyAdmin将其重新导入.

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

这篇关于升级到Mountain Lion后(使用MAMP)无法访问MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆