Moving connections and instances between two computers

MysqlMysql WorkbenchWorkbench

Mysql Problem Overview


I´ve got a mysql-server that I´m administrate remotely with MySQL Workbench.

Now I´ve got a new computer and I cant find any solution to move my connections and instances-profiles to my new computer. This can´t be an unsolved question, huh? Not the first time this would happen for someone else.

Correction: It´s not the server-instances that I want to move. I need to export/move/backup my many client-profiles/instances-connections in MySQL Workbench.

Mysql Solutions


Solution 1 - Mysql

You don't need to copy any files manually as other answers suggest. On both Windows and Mac you can export all your settings within MySQL Workbench and restore to another system.

Select Tools > Configuration > Backup Connections

This will export as a .zip. Then on your new new install just

Select Tools > Configuration > Restore Connections

Linux MySQL Workbench Backup/Restore Connections

That's it!

Solution 2 - Mysql

I had the same questions. I found a MySQL directory in %APPDATA%. Copy the entire directory to the same location on the new machine. You'll need clear your passwords and re-enter them. Once I did that, I was up and running again.

You can find your %APPDATA% folder in Windows by entering it in the address bar of Windows Explorer.

Solution 3 - Mysql

Found it on a mac in /Users/Username/Library/Application Support/MySQL/Workbench/

file called connections.xml

Solution 4 - Mysql

Backup and restore connections using the menus Tools > Configuration > Backup Connections and Tools > Configuration > Restore Connections is the easiest way, however it does not copy the passwords.

Extracting the passwords is possible in the following case:

  1. Old PC should be a Windows installation.
  2. You should be able to login using the Windows account who originally saved the passwords in Workbench, i.e. without having the Windows account's password reset by an admin.

If the above requirements are met, one can log into the old PC and run the decrypt tool found on http://www.donationcoder.com/forum/index.php?topic=41860.msg391762#msg391762

The C++ code to decrypt is shown below (credits: f0dder)

std::vector<unsigned char> decrypt(BYTE *input, size_t length) {
        DATA_BLOB inblob { length, input };
        DATA_BLOB outblob;
 
        if (!CryptUnprotectData(&inblob, NULL, NULL, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &outblob)) {
                throw std::runtime_error("Couldn't decrypt");
        }
 
        std::vector<unsigned char> output(length);
        memcpy(&output[0], outblob.pbData, outblob.cbData);
 
        return output;
}

Solution 5 - Mysql

In Linux (Ubuntu), the location was changed to $HOME/.mysql/workbench

Tested on Ubuntu 14.04 LTS.

Solution 6 - Mysql

Before replacing the connection.xml, make sure you close the Workbench application first, or the application will overwrite/save on the xml file on exit.

Solution 7 - Mysql

just copy them!

in Linux, they're at $HOME/.mysqlgui/

Solution 8 - Mysql

I found the file "WbProfiles.xml" in path C:\Users<UserName>.sqlworkbench\WbProfiles.xml

Either copy the file or copy complete ".sqlworkbench" folder under same path in new machine.

Solution 9 - Mysql

If you want to recover the passwords that are encrypted in "workbench_user_data.dat" file using Python in Windows, you can use the below snippet.

import os,win32crypt
encrypted_data = open(f"C:\\Users\\{os.getlogin()}\\AppData\\Roaming\\MySQL\\Workbench\\workbench_user_data.dat", "rb").read()
clear_data = win32crypt.CryptUnprotectData(encrypted_data, None, None, None, 0)
print(clear_data)

Solution 10 - Mysql

Sadly, on the latest version of the MySQL Workbench (8.0.25, 8.0.27 in windows at least), the backup and restore for .zip file formats does NOT work.

See here for details and a workaround: https://bugs.mysql.com/bug.php?id=102501

Solution 11 - Mysql

BACKUP work-around for this bug:

  • copy these two files: connections.xml and server_instances.xml
  • location of these files (in windows) is: C:\Users<user>\AppData\Roaming\MySQL\Workbench (replace with your own windows username)

To RESTORE: copy those above 2 files to the same location on the destination installation.

caveat: I don't know where the password "vault" is kept for the connections, so you may have to re-enter those, but the connections and server list are preserved.

Bonus: to restore your workspaces (all open .sql tabs, etc.) you can also copy the "sql_workspaces" directory underneath the "workbench" directory and it will restore those too!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMr RebelView Question on Stackoverflow
Solution 1 - MysqlGlyn JacksonView Answer on Stackoverflow
Solution 2 - MysqlAdamView Answer on Stackoverflow
Solution 3 - MysqlLeoView Answer on Stackoverflow
Solution 4 - MysqlnkatsarView Answer on Stackoverflow
Solution 5 - MysqlendrijuView Answer on Stackoverflow
Solution 6 - MysqlAung HtetView Answer on Stackoverflow
Solution 7 - MysqlJavierView Answer on Stackoverflow
Solution 8 - MysqlPriyadarshiniView Answer on Stackoverflow
Solution 9 - MysqlAeroStorm777View Answer on Stackoverflow
Solution 10 - Mysqlatom88View Answer on Stackoverflow
Solution 11 - Mysqlatom88View Answer on Stackoverflow