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 select Properties 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, and system below. Either will work, but let's change the system settings.
Scroll the list until you see the variable named Path in the Variable 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.