Reputation: 2958
In a terminal window I run:
export PATH=$PATH:/usr/local/mysql/bin>> ~/.bash_profile
Then when I echo $PATH the new path shows alright.
But if I close that window, open another window, the path disappears!
How to change the PATH variable?
Upvotes: 17
Views: 16745
Reputation: 943097
The command you have will set the path and then put the output from that command at the end of your .bash_profile.
You want to put the command itself into the .bash_profile.
echo 'export PATH=$PATH:/usr/local/mysql/bin' >> ~/.bash_profile
It won't take effect until you start a new terminal session.
Upvotes: 41
Reputation: 101
You don't need to start a new Terminal session in order to apply the changes to the ~/.bash_profile.
Just type in the Terminal
source ~/.bash_profile
Upvotes: 10
Reputation: 25032
You need to save the
export PATH=$PATH:/usr/local/mysql/bin
in the .bash_profile, as you're trying. However, the export statement is not just displayed text, so appending it won't work. Use an editor to do it.
Upvotes: 3