I have a bunch of remote MySQL servers that only allow connection with localhost. To connect to them, I do the following:
ssh host mysql -uuser -psecret -hhost.myhost.com
In emacs, I configured a connection to local MySQL using sql-mysql-mode:
(setq sql-connection-alist '((pool-a (sql-product 'mysql) (sql-server "localhost") (sql-user "user") (sql-password "secret") (sql-database "") (sql-port 3306)) )) (defun sql-connect-preset (name) "Connect to a predefined SQL connection listed in `sql-connection-alist'" (eval `(let ,(cdr (assoc name sql-connection-alist)) (flet ((sql-get-login (&rest what))) (sql-product-interactive sql-product))))) (defun sql-local () "Connect to the local MySQL server" (interactive) (sql-connect-preset 'pool-a) (delete-other-windows)) (define-key global-map [f10] 'sql-local)
So, every time I press F10 , I get a MySQL shell.
Is it possible to configure sql-mysql, so it connected to the external machine via ssh and used that mysql program on this machine so that I could connect from Emacs in all directions?
source share