Git bash在Windows 7上。mysqldump命令不起作用 [英] Git bash on windows 7. mysqldump command is not working
问题描述
我在Windows 7机器上使用git bash。当我尝试使用mysqldump时,出现错误:
sh.exe:mysqldump:command not found。我对此很新,有人可以帮我吗?
在bash用于查找命令的路径上,您需要 mysqldump
UN * X shell ,像bash和windows cmd,使用 PATH
环境变量来管理它。
要查看当前路径,在bash中输入:
$ echo $ PATH
如果您安装了MySQL,它通常位于 c:\ Program Files \ MySql
,并且支持程序,如 mysqldump
,位于 c:\程序文件\ MySql\MySQL Server 5.5\bin\
。你需要在你的路径上有这个目录。如果MySQL已经安装在你的机器上的其他地方,那么你需要找到 bin
目录并在这些说明中使用 路径。 p>
在Windows中执行此操作的最佳方法是更改用户或系统环境变量。要做到这一点,在Windows资源管理器中:
- 右键单击
计算机
,然后选择Properties
。
- 在结果窗口中,选择
高级系统设置
在结果对话框中,点击高级
标签。 - 点击
环境变量
按钮。 - 有两个部分,
user
在顶部,system
在下面。或者将工作,但让我们更改系统
设置。 - 滚动列表直到看到名为
路径
在变量
列中。 - 双击这个
code> row。
- 在结果对话框中的
变量值
字段中,滚动到最后该字段,最后添加:; c:\程序文件\ MySql\MySQL Server 5.5 / bin /
。 请注意分号:如果没有它,它将无法正常工作。 - 点击
确定
,现在您可以关闭所有的对话框/窗口。
完成所有这些后,关闭Git bash窗口并打开另一个窗口。类型:
$ mysqldump
您应该从程序中获取使用说明。
如果不是,请再次输入以下内容以查看路径:
$ echo $ PATH
你看到什么就像你添加了什么?那里有任何MySQL目录?很可能你错误地输错了一些东西,或者错过了分号。再次检查步骤并确保一切正确。
I'm using git bash on a windows 7 machine. When I try to use mysqldump I'm getting an error: "sh.exe": mysqldump: command not found". I am very new to this. Can somebody help me?
You'll need mysqldump
on the path that bash is using to find commands. UN*X shells, like bash, and also windows cmd, use a PATH
environment variable to manage this.
To see your current path, type this in bash:
$ echo $PATH
If you've installed MySQL, it's typically located at c:\Program Files\MySql
, and the support programs, like mysqldump
, are in c:\Program Files\MySql\MySQL Server 5.5\bin\
. You'll need to have that directory on your path. If MySQL has been installed somewhere else on your machine then you'll need to find the bin
directory there and use that path in these instructions.
The best way to do this in windows is by changing the user or system environment variables. To do this, in Windows Explorer:
- Right-click
Computer
and selectProperties
from the menu. - In the resulting window, choose
Advanced System Settings
in the sidebar. - In the resulting dialog, click the
Advanced
tab. - Near the bottom, click the
Environment Variables
button. - There are 2 sections,
user
at the top, andsystem
below. Either will work, but let's change thesystem
settings. - Scroll the list until you see the variable named
Path
in theVariable
column. - Double-click this
Path
row. - In the resulting dialog, in the
Variable value
field, scroll all the way to the end of the field, and at the end, add this:;c:\Program Files\MySql\MySQL Server 5.5/bin/
. Note the leading semicolon: it won't work without it. - Click
OK
and now you can close all the dialogs/windows.
Once you've done all that, close the Git bash window, and open another one. Type:
$ mysqldump
You should get Usage instructions from the program.
If not, look at the path again by typing:
$ echo $PATH
Do you see anything like what you added? Any MySQL directories there? It's likely you've just mistyped something, or missed the semicolon. Go over the steps again and make sure everything is correct.
这篇关于Git bash在Windows 7上。mysqldump命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!