Setting Environment Variables
An environment variable has a value that can be accessed
by programs that you run. By setting environment variables, you modify
your operating environment. One such variable is PATH
, which is used by your command
interpreter to determine which directories to search when it looks for
programs such as mysql that you tell
it to execute. If your PATH
is set
correctly, you can invoke programs easily no matter what your current
directory is. If PATH
is not set
correctly, your command interpreter will not find them. For example, if
the PATH
value does not include the
directory where mysql is installed, a
“command not found” error may occur if you attempt to run
mysql by entering its name. You must
run it either by specifying its full pathname, or by changing location
into the directory where it is installed. Both strategies are
unpleasant, and more so with repetition. It’s much better to set your
PATH
value to name the directories
containing the programs you want to use.
Other environment variables are important in other contexts. For
example, if you run Perl or Ruby scripts that use module files that
you’ve installed, you may need to set the PERL5LIB
or RUBYLIB
variable to tell Perl or Ruby where to
find those modules. For Java, the JAVA_HOME
variable should be set to indicate
the location of your Java installation, and CLASSPATH
should be set to the list of
libraries and class files that your Java programs need.
The following discussion describes how to set ...
Get MySQL Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.