MySQL 如何从mac终端制作mysql转储文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38675885/
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
how to make mysql dump file from terminal in mac
提问by Neeraj Sharma
how to import and export mysql dump file in mac
如何在mac中导入和导出mysql转储文件
like in windows, I use this code:
就像在 Windows 中一样,我使用以下代码:
mysqldump -u root -p --databases DBname>d:\ FILENAME.sql
but it does not work in mac terminal. it produce error:
但它在 mac 终端中不起作用。它产生错误:
-bash: mysqldump: command not found
回答by HiDeo
The location where mysqldump
is installed need to be declared in your $PATH
.
mysqldump
安装位置需要在你的$PATH
.
If you don't know how to edit your $PATH
on macOS, you can refer to this question.
如果你不知道如何$PATH
在 macOS上编辑你的,你可以参考这个问题。
For example, if your mysqldump
binary is located in /usr/local/mysql/bin
, you can edit your $PATH
to:
例如,如果您的mysqldump
二进制文件位于/usr/local/mysql/bin
,您可以编辑您$PATH
的:
export PATH=$PATH:/usr/local/mysql/bin
With this modification, you won't have to provide the full path to the mysqldump
binary every time and will be able to use your command:
通过此修改,您不必mysqldump
每次都提供二进制文件的完整路径,并且将能够使用您的命令:
$ mysqldump -u root -p --databases DBname>d:\ FILENAME.sql
回答by Neeraj Sharma
i forget to give path to it the query is
我忘了给它的路径查询是
/usr/local/mysql/bin/mysqldump -uroot -p friendstree > friendstree.sql
/usr/local/mysql/bin/mysqldump -uroot -pfriendstree >friendstree.sql
it worked
有效