I am working with a Redhat distribution. The network admin is inaccessible so I have no ability to request information.
Using bash, how do I find the mysql binary so that I can run sql commands?
mysql -u user -p password
-bash: mysql: command not found
So they did not set up the path.
It usually should be in the path already and can be executed with just calling
mysql
in the shell.If that's not working (and you have reason to expect the
mysql
CLI binary to be installed), you can try to find it withfind
:Example:
MySQL consists of two components, the MySQL server which is the actual database engine and the MySQL client, used to communicate with the database server from the command line.
The MySQL client is installed from the plain
mysql
software package. If it isn't available (check withrpm -q mysql
) useyum install mysql
after which themysql
command should available in your regular path or by it's default absolute path/usr/bin/mysql
.Run the following command:
which mysql
Example where no MySQL binary is installed:
Examlple where MySQL binary is installed to
/usr/bin/mysql
:Typically though, if just running
mysql
from the command line results in "comamnd not found", then the binary is not in your user'sPATH
, or is not installed at all.Verify that the mysql package is installed, e.g.,:
or rpm -qa |grep mysql
Note that the server itself is packaged as
mysql-server
.If it's not installed, you will need to install the client, though this will require root privileges to do so: