Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use MySQL interactively from an SQL block in org-mode?

I use R interactively from Org-mode - the keybinding C-x ' from within an R code-block launches an interactive R session using ESS.

When I press C-x ' from inside an SQL code block, it sends the code block to an SQL-mode buffer, but it is not clear how I can then send a query to MySQL.

Can I do this with MySQL?

like image 820
David LeBauer Avatar asked Apr 05 '12 15:04

David LeBauer


1 Answers

First, include the code from the accepted answer to How can I get emacs sql-mode to use the mysql config file (.my.cnf)? in your .emacs

Second, use C-x ' from within the SQL code block to send the code block to an SQL mode buffer

Once the code block has been sent to a buffer in SQL mode, launch your MySQL session using M-x pool-a (or whatever connection you wish to use).

At this point, the standard SQL keybindings can be used:

C-c C-c send paragraph
C-c C-r send selected region
C-c C-b send entire buffer
C-c C-s send string
like image 182
Abe Avatar answered Nov 01 '22 02:11

Abe