mysql is not recognised as an internal or external command,operable program or batch
I had set the MySQL path, but still getting the same error. Please let me know whether I followed the correct one or not.
MySQL location is: C:\Program Files\MySQL\MySQL Server 5.0\bin
In Windows, system variables I had set the path as:
- variable name:
MYSQL_HOME开发者_如何学编程
- variable value:
C:\Program Files\MySQL\MySQL Server 5.0\bin
For PATH setting:
- variable name:
PATH
- variable value:
.;%JAVA_HOME%\bin;%MYSQL_HOME%\bin...
If it is not the correct one, please let me know the correct path and its settings.
Simply type in command prompt :
set path=%PATH%;D:\xampp\mysql\bin;
Here my path started from D so I used D: , you can use C: or E:
MYSQL_HOME variable value=> C:\Program Files\MySQL\MySQL Server 5.0\bin
%MYSQL_HOME%\bin
See the problem? This resolves to a path of C:\Program Files\MySQL\MySQL Server 5.0\bin\bin
MYSQL_HOME:
C:\Program Files\MySQL\MySQL Server 5.0
Path:
%MYSQL_HOME%\bin;
Here is what I DO on my PC, I install all software that I usually used in
G:
partition not C:
if my operating system is fall (win 10), Do not need to reinstall them again and lose time, Then How windows work it update PATH automatic if you install any new program or piece of software,
SO
I must update PATH like these HERE! all the software I usually used 1- I created a folder called Program Files 2- I install all my programs data in this folder 3-and then going to PATH and add it Don't forget ;
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;G:\HashiCorp\Vagrant\bin;G:\xampp\php;G:\xampp\mysql\bin;G:\Program Files (x86)\heroku\bin;G:\Program Files (x86)\Git\bin;G:\Program Files (x86)\composer;G:\Program Files (x86)\nodejs;G:\Program Files (x86)\Sublime Text 3;G:\Program Files (x86)\Microsoft VS Code\bin;G:\Program Files (x86)\cygwin64\bin
MySQL location is: C:\Program Files\MySQL\MySQL Server 8.0\bin
In Windows, system variables I had set the path as:
variable name: MYSQL_HOME
variable value: C:\Program Files\MySQL\MySQL Server 8.025\bin
For User variable for user:
Click Path ---> NEW --->
C:\Program Files\MySQL\MySQL Server 8.0.25\bin
Click OK
Now check with cmd (
mysql -V
)You may get a command like this
mysql Ver 8.0.25 for Win64 on x86_64 (MySQL Community Server - GPL)
You're DONE.
I am using xampp. For me best option is to change environment variables. Environment variable changing window is shared by @Abu Bakr in this thread
I change the path value as C:\xampp\mysql\bin; and it is working nice
You only have to set path in the system variables and you are done with the job. Here I will show you step by step:
Step1: Go the start taskbar and write environment and click on the edit system environment option:
Step2: After clicking a dialog box namely System Properties Will occur like this:
Step3: Click on environment variables and then inside system variables in which there is written path, double click on path a new dialog box namely edit environment variables will be pop up as shown:
Then add the address of the MySql bin in windows C the path by clicking new path option, in my laptop MySql was here so added this path C:\Program Files\MySQL\MySQL Server 8.0\bin, thats it click ok and run on command prompt mysql --version command and it will show the actual version of mysql installed at your pc
You can fix in 3 steps
you have to change course by first > Copy file path
*my path is E:\Program\xampp\mysql\bin*
next in CMD I write the followin
that
set path=%PATH%;set path=%PATH%;E:\Program\xampp\mysql\bin
Don't forget to change PATH
In my case, it turned out to be a simple case of spacing.
Turns out, i had a space inserted after the last ; and before ""C:\Program Files\MySQL\MySQL Server 5.7" For this very simple reason, no matter what i did, MySql was still not being recognized.
Once i eliminated the spaces before and after path, it worked perfectly.
In retrospect, seems like a very obvious answer, but nobody's mentioned it anywhere.
Also, i'm new to this whole windows thing, so please excuse me if it sounds very simple.
If you use wamp server add C:\wamp64\bin\mysql\mysql5.7.31\bin
to environment variables PATH
To make it easier to invoke MySQL programs in CMD, you can add the path name of the MySQL bin directory to your Windows system PATH environment variable:
follow the below link.
https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html
In my case changing the directory to
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
I have noticed no changes but when I wrote mysql
It ran perfectly
If the error isn't solved after setting the system variables and path, check the path specified in User Variables. If the path is not set in user variables, add it. This worked for me.
This worked for me(Windows):
Firstly in cmd type: where{space}MySQL{enter}--->It gives something like this: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
Add path=C:\Program Files\MySQL\MySQL Server 8.0\bin to System variable. How to set path to system variable ?
Close and restart your Command prompt. After that write from anywhere in cmd: mysql --version
It will give results: mysql Ver 8.0.28 for Win64 on x86_64 (MySQL Community Server - GPL)
In my case, I resolved it by adding this path C:\xampp\mysql\bin
to system variables
path and then restarted pash/cmd
.
Note: Click me if you don't know how to set the path and system variables.
精彩评论