I am working with a Redhat distribution. Mysql is installed with the binary in the following path:


Furthermore, the environmental variable PATH echos:

echo $PATH

The server has been restarted but if I type


into bash it returns the following:

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

Please advise


Altered PATH EV to



export  mysql /opt/rh/mysql55/root/usr/bin
export  PATH  ${mysql}:${PATH}

Still get command not found

After rebooting the server, echo $PATH is now:


So, the path to mysql is gone.

  • Run /root/opt/rh/mysql55/root/usr/bin/mysql -u root, what is the result? – Braiam Jul 21 '14 at 19:38
  • Did you run export PATH? – dchirikov Jul 21 '14 at 19:54
  • If I fully qualify the path for mysql, then the client utility starts. – Roy Hinkley Jul 21 '14 at 20:04
  • Why is it installed in root's subdir? Most users (including the mysql user) cannot read or search in root's subdir. Probably works when you type the path yourself since you're already root. Your directory structure implies it would work just dandy in /opt/rh/... ... move it there, make owned by mysql:mysql and be done with it. – lornix Jul 22 '14 at 5:59
  • That's where the admin put it. – Roy Hinkley Jul 22 '14 at 11:05

You should add only the path, not the mysql executable itself. PATH is list of directories, not files.

Try adding:

  • i changed it but it still gives me the same error. – Roy Hinkley Jul 21 '14 at 19:38
  • @AndroidAddict: Did you add to PATH of your user? Can you give output locate bin/mysql? – cuonglm Jul 21 '14 at 19:39
  • I don't think so. I don't know what that means? – Roy Hinkley Jul 21 '14 at 19:41
  • @AndroidAddict: What ouput when you run locate bin/mysql? – cuonglm Jul 21 '14 at 19:43
  • Command not found – Roy Hinkley Jul 21 '14 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.