How to add mysql to the environment variable: 1. Open the /etc/profile configuration file; 2. Add the configuration [export PATH=/opt/lampp/bin:$PATH]; 3. Execute [source / etc/profile] command to make the configuration take effect.
Background:
In the lamp environment installed by yourself, when using mysql, you must specify the path to enter the database, which seems too much trouble. We can solve this problem by adding mysql to the environment variable (mysql execution path/opt/lampp/bin).
(Recommended tutorial: mysql tutorial)
Specific method:
1. First open the /etc/profile file and add the following at the end of the file Command:
export PATH=/opt/lampp/bin:$PATH
2. Execute the command source /etc/profile to make the configuration take effect.
3. After the execution is completed, we can log in to the database through the mysqsl -u root -p command in any path.
Related recommendations: php training
The above is the detailed content of How to add mysql to environment variables. For more information, please follow other related articles on the PHP Chinese website!