0

There are at least three major overviews that come up when searching for information on using sql with emacs (due to my insufficient reputation I can't 'afford' to link to them here).

I can find no mention in any of them of the need to set the variable sql-mysql-program when working with mysql servers. Yet I could not get M-x sql-mysql to work without following the advice from this SO question to set this variable as follows:

(setq sql-mysql-program "/path/to/your/mysql")

In fact, the only tutorials/documentation I've seen highlighting this variable are in the above SO question and another SO question about "emacs-how-to-use-ssh-tunnel-to-connect-to-remote-mysql" (which again I can't link to because of insufficient reputation.)

An alternate solution seems to be suggested here How to work with emacs and mysql, which suggests changing the value of the emacs exec-path.

The question is, which of these options is preferable, or is it simply a matter of taste?

And what is the significance of the fact that none of the above-linked overviews of sql/emacs mentions the need to get emacs to recognize the binary? Is there something wrong with my emacs?

I spent a long time combing the sql.el source to try to understand what was going on and I do see a (defcustom sql-mysql-program "mysql"…)but in my case at least that did not seem to do the trick (perhaps because I'm starting emacs up with -q option?).

PS. In case it matters, my M-x emacs-version is GNU Emacs 24.5.1 (x86_64-apple-darwin12.5.0, NS apple-appkit-1187.40) of 2015-05-01, which I am running on an older Mac (10.8.5)

Community
  • 1
  • 1

1 Answers1

0

Note that this can be generalised to a question of:

What do I do if Emacs can't find an executable?

which is where the exec-path list comes into play.

As noted in C-hig (emacs) Shell RET, the exec-path list is initialised from the environment variable PATH when Emacs is started (see also (emacs) General Variables), so there are multiple ways to populate that list with the values you need.

Using an absolute path to sql-mysql-program is also fine, but potentially less portable. It's up to you, really.

phils
  • 71,335
  • 11
  • 153
  • 198