1. #PATH = $PATH:/opt/lamp/mysql/bin
with this method, only the current session is valid, meaning that the PATH setting is invalidated whenever the system is logged out or logged off
2. #vi/etc/profile
add path= $PATH in place:/etc/apache/bin (Note: = is not allowed to have any spaces on either side of the equals sign) This method is best, unless you manually force the value of PATH to change, otherwise it will not be changed
However, in general, we do not directly in the face of modification, at the beginning of/etc/profile has such a hint:
# It's not a good idea to the change this file unless you know
# is doing. It ' s much better to create a custom.sh shell script in
#/etc/profile.d/to make custom changes to your environment, as this
# would prevent the need for merging on future updates.
so: Add a customer.sh text file to the/etc/profile.d/directory, open it and typing
Export path= $PATH:/opt/lamp/mysql/bin save exit, source/etc/profile immediate effect, the next landing will also take effect
3. #vi ~/.bash_profile
Modify the path line, add/opt/lamp/mysql/bin to this method is for the user to work
Note: To change path, you must re-login to take effect, the following methods can simplify the work:
If/etc/profile is modified, then the source profile or the Execute Point command is executed after the edit finishes. The value of/profile,path will take effect immediately. The principle of this method is to execute the/etc/profile shell script again, note that if the use of sh/etc/profile is not possible, because SH is executed in the child shell process, even if the path changes will not be reflected in the current environment, but the source is in the current Shell process, so we can see the change in path.
In general, the bin directory under the user's working directory will be included in the path, so just put the user's own shell script in the user's Bin directory, do not need to modify the configuration file.
Modify path Path under Linux