MySQL Workbench unable to restore workspace

Whenever I restart MySQL Workbench I get the following error:

enter image description here

That error doesn't make any sense to me. I'm able to open E:\Users\user_name\AppData\Roaming\MySQL in Explorer, so if I'm able to open that then E:\Users\user_name\AppData\Roaming\MySQL\..\ is clearly able to be opened as well.

So why am I getting this error? More importantly, what can I do to get rid of it? Should I uninstall / reinstall MySQL Workbench?


Solution 1:

Close the workbench then go to

    C:\Users\YOURUSER\AppData\Roaming\MySQL\Workbench\sql_workspaces

and delete all data and directories there.

Your last session will be not restored but the future sessions will.

Solution 2:

I know I'm replying after long time. But I found out a way of getting out of this situation. Note that, I was using Workbench 6.3 and MySQL server 5.7 while writing this answer.

I got this error "Could not read contents of..." when the laptop switched off all of a sudden when I moved the laptop a bit (battery loose connection problem) making Workbench and all applications closing unexpectedly, which is as good as the workbench getting crashed.

If you ever encounter the above error, do not click on either "Ignore" or "Cancel" button until you backup the workspace folder first. Go to

  1. "C:\Users\YOUR.USERNAME\AppData\Roaming\MySQL\Workbench\sql_workspaces\YOUR_CONNECTION_NAME". Select proper folder names in your system, wherever I've used capital letters. First keep a backup of all the files inside that folder.

  2. Open each file in your favorite editor, which is capable of opening non-human readable characters also. (I prefer Notepad++).

  3. No matter whether the file is connection_id or whichever the file it is, if you see the file filled with "Null" or any illegal characters, close that file and delete such files These files are the culprit here which makes workbench to show the error.

  4. Finally you should end up with only files that has human readable data in them.

  5. Now click either on "Cancel" or "Ignore" button, close the connection, try reopening the connection.

But now you can't see the table names in their tabs, instead, you will see whatever the random number those files has got inside the workspace folder.

This is your best shot of restoring auto saved queries. The rest of them are permanently lost.

Thank you.

Solution 3:

I've been having this problem for months on Windows 10. I just wanted to restore my previous session. I tried updating Workbench to the latest version and "Run as administrator". Nothing worked.

Heres how I finally got it to work:

  1. Open MySQL Workbench.
  2. Right-click on the MySQL Connections pane and select "Open Connection" from the right-click menu.
  3. Left click on the MySQL Connections pane as normal. All the old tabs are restored.
  4. Important: When you reopen MySQL workbench later this same process may need to be followed. I sure hope the bug is fixed in the meantime.

Solution 4:

Close the workbench then go to

C:\Users\YOURUSER\AppData\Roaming\MySQL\Workbench\sql_workspaces

and look for the [connection name].autosave folder.

Delete the lock file.

Reopen workbench.