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