Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certain string in Windows PATH causing error

I am adding this string C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\ to my windows 10 environmental variable PATH. This caused problem to the PATH. I believe the root cause is the character & in the string. How can I add the string successfully to the windows PATH?

like image 438
guagay_wk Avatar asked Mar 13 '23 23:03

guagay_wk


2 Answers

Try escaping the ampersand (&) with a carrot (^).

C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 ^& MySQL Utilities 1.5
like image 80
cwahls Avatar answered Mar 31 '23 11:03

cwahls


I had the same problem as you on windows 7 after installing MySQL 5.7.11.

The issue is that the MySQL installer adds two paths containing & to the PATH system variable without surrounding them by quotation marks.

This may cause all sorts of trouble to other BATCH files. For instance a simple:

echo %PATH% 

from the command line would actually execute the mysql client because MySQL appears after the & which Windows sees as way to combine separate commands. This caused other scripts like Python virtual environment activate to misbehave on my machine.

Surrounding the two MySQL paths in the PATH environment system variable permanently fixes the issue. So it looks like a bug in MySQL installer.

like image 43
user3748764 Avatar answered Mar 31 '23 13:03

user3748764