tags:

views:

676

answers:

2

I've been using Emacs's sql interactive mode to talk to the MySQL db server and gotten to enjoy it. A developer has set up another db on a new non-default port number but I don't know how to access it using sql-mysql.

How do I specify a port number when I'm trying to connect to a database?

It would be even better if Emacs can prompt me for a port number and just use the default if I don't specify. Any chances of that?

+5  A: 

UPDATED:

I got it wrong the first time. Here's the correct answer:

(setq sql-mysql-options (list "-P <port number>"))

Sorry about that.

Marcel Levy
+2  A: 

I found the option using:

M-x customize-group
SQL

That included a setting labeled:

Mysql Options:

If you set the option and save it, there will be a new line added to your .emacs:

(custom-set-variables
 '(sql-mysql-options (quote ("-P ???"))))

(Obviously, you ought to use the actual port number.)

I use XEmacs, so your mileage may vary.

Jon Ericson