Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

/root/opt/rh/mysql55/root/usr/bin/mysql

Furthermore, the environmental variable PATH echos:

echo $PATH
/root/opt/rh/mysql55/root/usr/bin/mysql:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/opt/rh/mysql55/root/usr/bin/mysql

The server has been restarted but if I type

mysql 

into bash it returns the following:

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

Please advise

EDIT

Altered PATH EV to

/root/opt/rh/mysql55/root/usr/bin

using

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:

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

So, the path to mysql is gone.

share|improve this question
    
Run /root/opt/rh/mysql55/root/usr/bin/mysql -u root, what is the result? –  Braiam Jul 21 at 19:38
    
Did you run export PATH? –  dchirikov Jul 21 at 19:54
    
If I fully qualify the path for mysql, then the client utility starts. –  Android Addict Jul 21 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 at 5:59
    
That's where the admin put it. –  Android Addict Jul 22 at 11:05

1 Answer 1

up vote 6 down vote accepted

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

Try adding:

/root/opt/rh/mysql55/root/usr/bin/
share|improve this answer
    
i changed it but it still gives me the same error. –  Android Addict Jul 21 at 19:38
    
@AndroidAddict: Did you add to PATH of your user? Can you give output locate bin/mysql? –  Gnouc Jul 21 at 19:39
    
I don't think so. I don't know what that means? –  Android Addict Jul 21 at 19:41
    
@AndroidAddict: What ouput when you run locate bin/mysql? –  Gnouc Jul 21 at 19:43
    
Command not found –  Android Addict Jul 21 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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