将 mysqldump 添加到 MAMP(MacOS X 上的 MySQL /w Apache PHP)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3268789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
add mysqldump to MAMP (MySQL /w Apache PHP on MacOS X)
提问by Matt Bannert
I wonder how I can add mysqldump to my MAMP environment. I googled a bit and found only the community MySQL server version. But I do not want to install another MySQL –?basically because I want to save my data first, before any experiment.
我想知道如何将 mysqldump 添加到我的 MAMP 环境中。我用谷歌搜索了一下,只找到了社区 MySQL 服务器版本。但是我不想安装另一个 MySQL——主要是因为我想在任何实验之前先保存我的数据。
thx for help in advance (probably it′s just a simple link :)
提前寻求帮助(可能只是一个简单的链接:)
回答by Matt Bannert
Found the solution on my own. Maybe this helps other Mac users... In fact mysqldump ships with MAMP but is located somewhere in the desert:
我自己找到了解决方案。也许这对其他 Mac 用户有帮助……事实上 mysqldump 与 MAMP 一起提供,但位于沙漠中的某个地方:
/Applications/MAMP/Library/bin/mysqldump
/Applications/MAMP/Library/bin/mysqldump
That′s why tools like MySQL workbench do not find it, neither does it work in terminal without the path. So finally just type:
这就是为什么像 MySQL workbench 这样的工具找不到它,它在没有路径的终端中也不起作用。所以最后只需输入:
/Applications/MAMP/Library/bin/mysqldump -u yourUser -p --opt yourdb > yourdump.sql
to create a dump.
创建转储。
回答by Emanuil Rusev
In .bash_profile
, add PATH="$PATH:/Applications/MAMP/Library/bin"
.
中.bash_profile
,添加PATH="$PATH:/Applications/MAMP/Library/bin"
。
If you don't have a .bash_profile
, you can create one.
如果您没有.bash_profile
,则可以创建一个。
回答by Andrew Lazarus
I've recently discovered that MAMP PRO hides all your mysql terminal abilities.
我最近发现 MAMP PRO 隐藏了您所有的 mysql 终端功能。
Using this though copies all the mamp Mysql magic over to your local bin, where you can start using all wp-cli db functions again or anything that you need with databases via terminal:
使用这个虽然将所有 mamp Mysql 魔法复制到您的本地 bin,您可以在那里再次开始使用所有 wp-cli db 函数或通过终端使用数据库所需的任何内容:
sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql;
sudo ln -s /Applications/MAMP/Library/bin/mysqlcheck /usr/local/bin/mysqlcheck;
sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump
回答by Swapnil Mokashi
/usr/local/mysql-5.6.20-osx10.8-x86_64/bin/mysqldump -u root -p databasename tablename > /Library/WebServer/Documents/upload/kg_exam_metadata.sql;
/usr/local/mysql-5.6.20-osx10.8-x86_64/bin/mysqldump -u root -p databasename tablename > /Library/WebServer/Documents/upload/kg_exam_metadata.sql;
回答by Fredrick SujinDoss
This will helps you to resolve:
这将帮助您解决:
- In your home directory create or edit the file
.bash_profile
you can access your home directory by typing:cd ~/
Add this to the top of the file:
export PATH=$PATH:/Applications/MAMP/Library/bin
Save the file and then restart your Terminal
- In your newly restarted Terminal window type:
mysql –version
- 在您的主目录中创建或编辑文件,
.bash_profile
您可以通过键入以下内容访问您的主目录:cd ~/
将此添加到文件的顶部:
export PATH=$PATH:/Applications/MAMP/Library/bin
保存文件,然后重新启动终端
- 在您新启动的终端窗口中输入:
mysql –version