Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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'm trying like mad to get rails dbconsole to work (Rails 3.2.6, if that helps). The problem is that when I run the command, I get:

gems/railties-3.2.6/lib/rails/commands/dbconsole.rb:81:in `exec': Permission denied -
/usr/local/bin/mysql (Errno::EACCES)

I am using OS X Lion, and the usual way of running mysql at the command line works - it just doesn't work through rails dbconsole. The permissions on the /usr/local/bin/mysql are:

$ ls -la /usr/local/bin/mysql
lrwxr-xr-x  1 root  admin  16 Mar 13 20:27 /usr/local/bin/mysql -> /usr/local/mysql

The user I am calling these commands from is in the 'Admin' group (as evidenced in the Preferences -> Users dialog)

Any ideas on how to fix this? What could be the cause of mysql being able to run at the command line but not through another program (ruby/rails in this case).

And while I'm at this permissions problem, could you point me to a decent article/book/method that will help me to understand the permissions system and help troubleshoot such problems in future?

share|improve this question
What are the permissions on /usr/local/mysql? The permissions on a symlink mean precious little. – Matthew Scharley Jun 16 '12 at 8:59
Exactly the same permissions, but the group is wheel (the group for usr/local/bin/mysql is admin - as mentioned in the question) – Zabba Jun 16 '12 at 9:10
Please post the output of ls -ld /usr /usr/local /usr/local/mysql, of type mysql, and of head -n1 gems/railties-3.2.6/lib/rails/commands/dbconsole.rb. – Gilles Jun 17 '12 at 1:22

Conjecture: mysql doesn't run /usr/local/bin/mysql, but a mysql executable at some other location in $PATH. It is unusual to have /usr/local/mysql be an executable file: I would expect it to be a directory, if it exists at all. Run

type mysql

to see what mysql really runs, and if necessary, correct the /usr/local/bin/mysql symbolic link to point to the right place.

You can see what is really behind the symbolic link by adding the -L option to ls (and -d, in case it turns out to be a directory):

ls -lLd /usr/local/bin/mysql
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.