So as I am reading about powershell now a days and I find this interesting and wanted to know answer myself, on some googling here is what I found:
Considering that you are using similar command as given below to fire the Mysql
PS C:\Program Files\mysql\MySQL Server 5.7\bin> mysql
Here is the full version of error that you should be getting :
mysql : The term 'mysql' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct
and try again. At line:1 char:1+ mysql
+ CategoryInfo : ObjectNotFound: (mysql:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command mysql was not found, but does
exist in the current location. Windows PowerShell does not load
commands from the current location by default. If you trust this
command, instead type: ".\mysql". See "get-he lp
about_Command_Precedence" for more details.
If we see the Suggestion part it says Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\mysql".
So try using
.\mysql instead of just
mysql after setting the current directory to
C:\Program Files\mysql\MySQL Server 5.7\bin> but this might lead you to another error which most probably will say :
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (usingpassword: NO)
which you can than resolve changing the syntax to
mysql -u root -p
So it looks like kinda security thing that powersehll is imposing.
Note: Try running
$env:Path in powershell to see if the path is correctly set.