Setting $PATH environment variable in Bash - 12/29/03 02:24 AM
I have just installed MySQL and I am getting tired of having to type the full path name to start the server manually (/usr/local/mysql/bin/mysqld_safe --user=mysql). I thought I would add this path to my $PATH environment variable. So I typed the following to add this path:
This works great only for the current session. If I move to another x-windows terminal (on the same machine just another window running a terminal) then the $PATH I just created isn't visible to any other terminal. So I thought I will just add this new path to my .bash_profile. Here is what my bash_profile looks like right now after adding /usr/local/mysql/bin to my path.
If I close the current window that I am running a terminal in and start a new terminal then you would think bash would read the .bash_profile before starting the shell. Apparently it isn't rereading the .bash_profile or I am not adding the path /usr/local/mysql/bin to my $PATH variable correctly. Does anyone see what I am doing wrong? I am aware of creating an aliase but I don't want to do it that way. I want to know what I am doing wrong here.
I want the path /usr/local/mysql/bin to be part of my path whenever I start a terminal. I am tired of typing the full path name everytime I start and stop the MySQL server.
Thanks
Code:
PATH=$PATH":/usr/local/mysql/bin"
This works great only for the current session. If I move to another x-windows terminal (on the same machine just another window running a terminal) then the $PATH I just created isn't visible to any other terminal. So I thought I will just add this new path to my .bash_profile. Here is what my bash_profile looks like right now after adding /usr/local/mysql/bin to my path.
Code:
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin PATH=$PATH:/usr/local/mysql/bin BASH_ENV=$HOME/.bashrc USERNAME="root" export USERNAME BASH_ENV PATH
If I close the current window that I am running a terminal in and start a new terminal then you would think bash would read the .bash_profile before starting the shell. Apparently it isn't rereading the .bash_profile or I am not adding the path /usr/local/mysql/bin to my $PATH variable correctly. Does anyone see what I am doing wrong? I am aware of creating an aliase but I don't want to do it that way. I want to know what I am doing wrong here.
I want the path /usr/local/mysql/bin to be part of my path whenever I start a terminal. I am tired of typing the full path name everytime I start and stop the MySQL server.
Thanks