作者:NANA-LS | 来源:互联网 | 2023-08-29 18:15
AddinginaPermanentLocationTomakethenew?path?stickpermanentlyyouneedtocreatea?.bash_profile
Adding in a Permanent Location
To make the new path stick permanently you need to create a .bash_profile file in your home directory and set the path there. This file control various Terminal environment preferences including the path.
cd
Move into home directory
nano .bash_profile
Create the .bash_profile file with a command line editor called nano
export PATH="/usr/local/mysql/bin:$PATH"
Add in the above line which declares the new location /usr/local/mysql/bin as well as the original path declared as $PATH.
Save the file in nano by clicking ‘control’ +’o’ and confirming the name of the file is .bash_profileby hitting return. And the ‘control’+’x’ to exit nano
So now when the Terminal is relaunched or a new window made and you check the the path by
echo $PATH
You will get the new path at the front followed by the default path locations, all the time
/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
亲测可行的Yosemite设置环境变量方法