Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just finished installing mysql and mysqlserver on centOS as part of a larger install script (the full script is here, though I uncommented the mysql part).

The script ran fine, and it even walked me through the paces of setting up the mysql root password etc.

Script output:

mysql.x86_64 0:5.1.61-1.el6_2.1
mysql-server.x86_64 0:5.1.61-1.el6_2.1

Now, in the same session is SSH, I'm unable to access mysql or find any reference to it.

$ mysql -u root -p
-bash: mysql: command not found

$ which mysql
/usr/bin/which: no mysql in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

It's just weird- where is it??

share|improve this question
Are you absolutely sure that your script and SSH session are on the same machine? What happens if you run "rpm -ql mysql" to list the files installed by the mysql package? – 200_success May 9 '12 at 21:12

which is only aware of what's in your path.

Either chances are this installed somewhere like /opt/mysql/bin or elsewhere.

I'd suggest running updatedb && locate bin/mysql to get a more vast coverage of where it could be.

Also, you should confirm it's actually running ps waux |grep mysql - that should also give you where the binaries are if it installed and launched the daemon.

share|improve this answer
Red Hat, Fedora and CentOS packages install the mysql client to /usr/bin usually. Unless the script (I can't download it to check for myself) sets up some external repositories I'd expect these packages to install to /usr/bin. – Bram May 9 '12 at 19:46
One would expect ;) – thinice May 9 '12 at 19:47




mysql --version 

Try looking in /var/lib/mysql/. Thats where it is usually stored. If not then your installation failed, and like the above answer check if the installation part is commented out or not.

share|improve this answer

Your script didn't install. The installation part is commented

# MySQL install untested! # Install mysql packages (optional) #yum install mysql mysql-server

# Enable mysql to start at boot (optional) #chkconfig --levels 235 mysqld on #service mysqld start

share|improve this answer
According to the question the OP uncommented that part. But it is something to check to be certain. What is the output of rpm -qa|grep mysql? – Bram May 9 '12 at 19:42
Bram thank you. Sorry I misread the question. Yes your suggestion is more appropriate. – Chakri May 9 '12 at 19:44

find / -name mysql

Or alternatively try rehash(1) to rebuild the path cache, then try to login to MySQL again.

Don't forget to start the server too

share|improve this answer

Your Answer


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.