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>

28 thoughts on “Remapping MySQL Workbench “Execute SQL” to F5”

    1. 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

    1. 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

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

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

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

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

  5. 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.

  6. 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.

  7. 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.

  8. 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.

Leave a Reply