Lance Larsen - .NET Architect Madison Wisconsin

Remapping MySQL Workbench “Execute SQL” to F5

mysqlAs a primarily Microsoft SQL Server developer, when playing around with MySQL database ( specifically using MySQL Workbench ) wanted to be able to press F5 to execute the SQL commands that I was writing, by default you need to press Control-Enter or Control-Shift-Enter – but there is no GUI interface to remap keys shortcuts like there is in most Microsoft programs… so… found that the following worked and wanted to share!

Locate your “main_menu.xml” MySQL configuration file – mine was in “C:\Program Files (x86)\MySQL\MySQL Workbench CE 6.0.6\data\main_menu.xml”.  Find the following XML.
 

   1:  <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.query.execute_current_statementwin"> 
   2:    <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.query</link> 
   3:    <value type="string" key="caption">Execute Current Statement</value> 
   4:    <value type="string" key="name">query.execute_current_statement</value> 
   5:    <value type="string" key="command">builtin:query.execute_current_statement</value> 
   6:    <value type="string" key="itemType">action</value> 
   7:    <value type="string" key="shortcut">Modifier+Return</value>
   8:    <value type="string" key="platform">windows</value>
   9:  </value> 

Replace the “shortcut” xml (line 7 above) with the following, exit and reopen MySQL Workbench – and you’re rocking with F5!

<value type="string" key="shortcut">F5</value>

 
Comments

Thanks for this, that was driving me crazy

Woo hoo! Thank you.

Thank you very much.

Awesome!!!!

Awesome, cheers

Personally, I prefer F5 to execute all the SELECTED text (which may be multiple statements). So I had to edit the line that started:
instead

Great Post, the simple solution that I was hoping for :)

Likewise this massively stops me getting annoyed hitting the same key over and over again forgetting that it’s not management studio

OMG I can’t believe how simple that was, and how much feelgood factor it gives in return!! Thank you so much.

Figured it out, if you highlight the empty row above the highlighted query, it runs the un-highlighted query above. If the highlight is only the query row, it works as expected.

Another in the chorus of thanks, was also driving me crazy! Note though that I set com.mysql.wb.menu.query.exec instead of com.mysql.wb.menu.query.execute_current_statement, as the latter just runs a single statement. The former is more like SSMS, at least in my configuration.

I agree with Ian.

This is more like SSRS.
Thanks to original OP too for coming up with this.

Regards

David

great stuff…..this was so annoying!

Leave a Reply to CS