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?
PATH is a system-level variable that holds a list of directories. When you enter a command in the terminal, it's shorthand for a program with the same name. The system looks in each of the PATH directories for the program corresponding to the command.
The default PATH and MANPATH values are in /etc/paths and /etc/manpaths . And also the path-helper reads files in the etc/paths. d and /etc/manpaths. d directories.
I searched on how to remove variables from $PATH and followed these steps : Gave the command PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" Did echo $PATH which showed /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin. gave the command export PATH.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With