MySQL 在两台计算机之间移动连接和实例
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4450880/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Moving connections and instances between two computers
提问by Mr Rebel
I′ve got a mysql-server that I′m administrate remotely with MySQL Workbench.
我有一个使用 MySQL Workbench 远程管理的 mysql 服务器。
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 Workbench 中导出/移动/备份我的许多客户端配置文件/实例连接。
采纳答案by Adam
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.
我有同样的问题。我在 %APPDATA% 中找到了一个 MySQL 目录。将整个目录复制到新机器上的相同位置。您需要清除密码并重新输入。一旦我这样做了,我又开始了。
You can find your %APPDATA% folder in Windows by entering it in the address bar of Windows Explorer.
您可以通过在 Windows 资源管理器的地址栏中输入它来在 Windows 中找到您的 %APPDATA% 文件夹。
回答by Glyn Hymanson
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.
您不需要像其他答案建议的那样手动复制任何文件。在 Windows 和 Mac 上,您都可以导出 MySQL Workbench 中的所有设置并还原到另一个系统。
Select Tools > Configuration > Backup Connections
This will export as a .zip. Then on your new new install just
这将导出为 .zip。然后在你的新安装上
Select Tools > Configuration > Restore Connections
That's it!
就是这样!
回答by Leo
Found it on a mac in /Users/Username/Library/Application Support/MySQL/Workbench/
在 Mac 上的 /Users/Username/Library/Application Support/MySQL/Workbench/ 中找到它
file called connections.xml
名为 connection.xml 的文件
回答by endriju
In Linux (Ubuntu), the location was changed to $HOME/.mysql/workbench
在 Linux (Ubuntu) 中,位置更改为 $HOME/.mysql/workbench
Tested on Ubuntu 14.04 LTS.
在 Ubuntu 14.04 LTS 上测试。
回答by nkatsar
Backup and restore connections using the menus Tools > Configuration > Backup Connectionsand Tools > Configuration > Restore Connectionsis the easiest way, however it does not copy the passwords.
使用菜单工具 > 配置 > 备份连接和工具 > 配置 > 恢复连接来备份和恢复连接是最简单的方法,但它不会复制密码。
Extracting the passwords is possible in the following case:
在以下情况下可以提取密码:
- Old PCshould be a Windows installation.
- 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.
- 旧 PC应该是 Windows 安装。
- 您应该能够使用最初在 Workbench 中保存密码的 Windows 帐户登录,即无需管理员重置 Windows 帐户的密码。
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
如果满足上述要求,可以登录旧PC并运行http://www.donationcoder.com/forum/index.php?topic=41860.msg391762#msg391762上的解密工具
The C++ code to decrypt is shown below (credits: f0dder)
解密的 C++ 代码如下所示(来源: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;
}
回答by Javier
just copy them!
只需复制它们!
in Linux, they're at $HOME/.mysqlgui/
在 Linux 中,他们在 $HOME/.mysqlgui/
回答by Aung Htet
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.
在替换 connection.xml 之前,请确保先关闭 Workbench 应用程序,否则应用程序将在退出时覆盖/保存在 xml 文件中。
回答by Priyadarshini
I found the file "WbProfiles.xml" in path C:\Users\.sqlworkbench\WbProfiles.xml
我在路径 C:\Users\.sqlworkbench\WbProfiles.xml 中找到了文件“WbProfiles.xml”
Either copy the file or copy complete ".sqlworkbench" folder under same path in new machine.
在新机器的同一路径下复制文件或复制完整的“.sqlworkbench”文件夹。