method to resolve Bash:mysql:command not found _mysql

Source: Internet
Author: User

root@db-02 ~]# mysql-u Root
-bash:mysql:command not found


Reason: This is because the system by default will look for commands under/usr/bin, if this command is not in this directory, of course, will not find the command, we need to do is map a link to the/usr/bin directory, the equivalent of creating a linked file.
First you need to know the full path to the MySQL command or mysqladmin command, such as the MySQL path is:/usr/local/mysql/bin/mysql, we can execute the command:

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

The following are supplementary:

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

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

There are other commonly used commands mysqladmin, mysqldump and so on can be used in this way to solve.
Note: Where Mysqlpath is the actual installation path for MySQL

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.