7

Usually MySQL workbench would load up all existing SQL tabs whenever I clicked on connection.

Today I tried and it is not loading my existing session back and I don't have any backup of my SQL code I wrote on workbench.

Is there any way to retrieve the session back or restore the last session with all the TABS?

war10ck
  • 103
  • 1
  • 1
  • 8
  • To the CV-er, note that questions about using software *related to programming* are considered **on-topic** at Stack Overflow. – TylerH Oct 05 '15 at 18:37
  • Did you check the various files/directories listed here? http://dev.mysql.com/doc/workbench/en/wb-configuring-files.html ... Sounds like something went wrong and that it's too late to reopen the old session. Also, hopefully the "Save snapshot of open editors on close" preference was enabled, and also "Auto-save scripts interval". – Philip Olson Oct 05 '15 at 19:15

5 Answers5

9

I found this Googling as was also looking for code I'd neglected to save before closing Workbench. It wasn't in the sql_workspaces but I found it logs all queries actually executed in this file and was able to pull what I needed from there:

\%APPDATA%\MySQL\Workbench\log\sql_actions_unconnected.log
gofr1
  • 15,741
  • 11
  • 42
  • 52
Ivan McA
  • 205
  • 2
  • 10
  • 3
    Not sure why somebody voted this down, this worked for me. Path for OSX is `~/Library/Application Support/MySQL/Workbench/log` – esco_ Jan 17 '17 at 17:05
2

If you use a Mac and have TimeMachine I found that I could go back to the old version of the folder where it was stored and restore

~[user]/Library/Application Support/MySQL/Workbench/sql_workspaces/

Each directory below that is an instance of a saved work environment and restoring the directory allowed Workbench to reopen it when I reopened the connection. Phew!

(Library is a hidden folder).

1

Enable Edit>Preferences>SQL Editor>Save snapshot of open editors on close.

Even with this option checked, I experienced your problem with Workbench 6.0.X so I updated to latest version (6.3.X) and it was solved. I think there was a bug.

daniherculano
  • 373
  • 1
  • 9
  • 26
1

If the save snapshot option is enable then you can find the data in \%APPDATA%\MySQL\Workbench\log\sql_actions_unconnected.log

nunnithan
  • 51
  • 1
1

If nothing else, you can at least try and recover the tab contents manually as described here.

yagni
  • 1,160
  • 13
  • 15