How to add mysql to the command line in linux

Source: Internet
Author: User
Tags mysql commands
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.