I am playing mysql in the virtual machine today. When logging on to mysql, the system prompts [root @ localhostweb] # mysql-uroot-p-bash: mysql: commandnotfound is because the mysql PATH is not added to the system's PATH variable. To add mysql to the command line, You need to modify the root. the PATH variable in bash_profile. Here, root is
I am playing mysql in the virtual machine today. When logging on to mysql, the system prompts [root @ localhost web] # mysql-uroot-p-bash: mysql: command not found is because the mysql PATH is not added to the system's PATH variable. To add mysql to the command line, modify/root /. the PATH variable in bash_profile. Here, root is
I am playing mysql in the virtual machine today. When logging on to mysql, the following message is displayed:
[Root @ localhost web] # mysql-uroot-p
-Bash: mysql: command not found
Because the mysql PATH is not added to the system's PATH variable
To add mysql to the command line, modify the PATH variable in/root/. bash_profile.
Here, root is your user name and. bash_profile is a system hidden file.
PATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin
Add the mysql/bin PATH at the end of PATH.
Then source/root/. bash_profile takes effect immediately.
[Root @ localhost web] # mysql-uroot-p
Enter password:
Now you can run the mysql command.
However, this is added to the. bash_profile file under the currently used root user. mysql commands can only be found when the root user is used.
Add it to the/etc/profile file, and then
Source/etc/profile
It can act as a global variable.
This means that you can log on with a non-root account and find the mysql command.
Original article address: how to add mysql to the command line in linux, thanks to the original author for sharing.