Install MySQL error-bash:mysql:command not found

Source: Internet
Author: User

After installing MySQL (installation file), you cannot go directly to MySQL on the command line.


Because the command line is directly looking for the command below/usr/local/bin, we need to put the MySQL command into the. Bash_profile.



Vim ~/.bash_profile Add: Export path= $PATH:/usr/local/mysql/bin Save, exit


Restart (load) bash_profile file


SOURCE ~/.bash_profile


You can do it.



# mysql-u Root
-bash:mysql:command not found


Cause: This is because the system will find the command under/usr/bin by default, if this command is not in this directory, of course, will not find the command, we need to do is to map a link to the/usr/bin directory, equivalent to create a link file.
The first thing you need to know is the full path to the MySQL command or mysqladmin command, such as the path to MySQL:/usr/local/mysql/bin/mysql, we can execute the command like this:

# ln-s/usr/local/mysql/bin/mysql/usr/bin

Here are the additions:

Under Linux, in the case of MySQL normal operation, enter the MySQL prompt:
MySQL command not found

Encounter-bash:mysql:command not found situation, this is because the/usr/local/bin directory is missing MySQL, only need a way to establish a soft link, that can be resolved:
Map the MySQL installation directory, such as Mysqlpath/bin/mysql, to the/usr/local/bin directory:
# Cd/usr/local/bin
# ln-fs/mysqlpath/bin/mysql MySQL

There are other commonly used commands such as mysqladmin, mysqldump, etc. can be resolved by this method when not available.
Note: Where Mysqlpath is the actual installation path of MySQL


Install MySQL error-bash:mysql:command not found

Related Article

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.