Windows 下 MySQL 中的自动完成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/269653/
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
Autocomplete in MySQL under Windows
提问by Michael Pliskin
Does anybody know if there is a way to make autocompletion work in MySQL Command Line Client under Windows? It's working nicely under Linux for me, but simply moves the cursor under Windows instead.
有谁知道是否有办法在 Windows 下的 MySQL 命令行客户端中进行自动完成?对我来说,它在 Linux 下运行良好,但只是在 Windows 下移动光标。
回答by Bill Karwin
It ought to work this way:
它应该这样工作:
C:\> mysql --auto-rehash
Or configure your my.cnf:
或者配置你的 my.cnf:
[mysql]
auto-rehash
edit:My apologies. I have found some references that the tab-completion feature in mysql client works only on UNIX/Linux. It does not work on Windows.
编辑:我很抱歉。我发现一些参考资料表明 mysql 客户端中的制表符完成功能仅适用于 UNIX/Linux。它不适用于 Windows。
update:The reason for this is mentioned briefly in MySQL bug #4731:
更新:在 MySQL bug #4731中简要提到了这个原因:
[31 Jul 2004 12:47] Sergei Golubchik
I just downloaded 4.0.15 - command completion in mysql.exe is NOT working, as expected. It was never working in mysql.exe because we were not able to make readline to compile with VC++.
mysqlc.exe is a cygwin build, and it is linked with readline.
[2004 年 7 月 31 日 12:47] Sergei Golubchik
我刚刚下载了 4.0.15 - mysql.exe 中的命令完成不起作用,正如预期的那样。它从未在 mysql.exe 中工作,因为我们无法使 readline 使用 VC++ 进行编译。
mysqlc.exe 是一个 cygwin 版本,它与 readline 链接。
Explanation: GNU readlineis a standard open-source library for handling user input. The MySQL team uses the readline library, but they are not its author. From the above comment, I understand that they were unsuccessful in compiling the readline library on Windows with Microsoft Visual C++, the tool they use to build the MySQL product. Some open-source projects have not been made fully compatible with the Microsoft Windows environment.
说明: GNU readline是一个用于处理用户输入的标准开源库。MySQL 团队使用 readline 库,但他们不是它的作者。从上面的评论中,我了解到他们在使用 Microsoft Visual C++(他们用来构建 MySQL 产品的工具)在 Windows 上编译 readline 库时没有成功。一些开源项目尚未与 Microsoft Windows 环境完全兼容。
At one time in the past, the MySQL product provided an alternative client they called mysqlc.exe
, which they compiled with the cygwintoolset on Windows, but they don't provide this anymore. The cygwin toolset includes the readline library, so it was possible to compile the mysqlc.exe
client with support for tab-completion.
在过去的某个时候,MySQL 产品提供了一个他们称为 的替代客户端mysqlc.exe
,他们使用Windows上的cygwin工具集编译了该客户端,但他们不再提供此功能。cygwin 工具集包含 readline 库,因此可以编译mysqlc.exe
支持制表符补全的客户端。
So in theory, if you are really intrepid, you could download the cygwin toolset including the readline library, then download the MySQL source code and build it using cygwin. Then you should have a mysql client program that can perform tab-completion. But this sounds like a lot of work even for someone who is familiar with building MySQL from source.
所以理论上,如果你真的很勇敢,你可以下载包含 readline 库的 cygwin 工具集,然后下载 MySQL 源代码并使用 cygwin 构建它。那么你应该有一个可以执行tab-completion的mysql客户端程序。但这听起来像是很多工作,即使对于熟悉从源代码构建 MySQL 的人来说也是如此。
回答by AngryHacker
This is probably not what you are looking for, but the enterprise version of SQLYog offers a somewhat limited schema auto-completion.
这可能不是您要查找的内容,但 SQLYog 的企业版提供了有限的模式自动完成功能。
回答by paka
If above dosen't work and you use widnows 10 you can install linux shell, then install mysql-client and connect like in terminal in linux where autocomplite works.
如果以上不起作用并且您使用 widnows 10,您可以安装 linux shell,然后安装 mysql-client 并像在自动编译工作的 linux 终端中一样连接。
Instruction: https://docs.microsoft.com/en-us/windows/wsl/install-win10
说明:https: //docs.microsoft.com/en-us/windows/wsl/install-win10