Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore MySQL workbench session and retrieve the SQL tabs back?

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?

like image 422
war10ck Avatar asked Oct 05 '15 15:10

war10ck


4 Answers

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
like image 188
Ivan McA Avatar answered Oct 10 '22 04:10

Ivan McA


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

like image 44
Neil Iosson Avatar answered Oct 10 '22 03:10

Neil Iosson


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.

like image 24
daniherculano Avatar answered Oct 10 '22 04:10

daniherculano


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

like image 25
nunnithan Avatar answered Oct 10 '22 04:10

nunnithan