`

auto-rehash

 
阅读更多
mysql      auto-rehash:读取表信息和列信息,可以在连上终端后开启tab补齐功能。
                 不启用auto-rehash功能,可以在mysql -h  连接时指定-A选项。
                若mysql的默认连接没有设置auto-rehash,也可以在 mysql连接数据库时使用 --auto-rehash来设定使用此选项,开启tab补齐功能。

这几天才知道MySQL 命令(command)自动补齐功能 (用了好几年MySQL,现在才知道,真是惭愧呀)

但是默认不是开启的。若要开启此功能,可以在Linux中

vi /etc/my.cnf

[mysql]

#no-auto-rehash

auto-rehash         #添加auto-rehash

即将[mysql]中的no-auto-rehash改为auto-rehash

再次登陆MySQL就可以自动补全了。

如果你想尝试在Windows中做同样尝试,会发现不会成功。

原因在下面的英文中有解释:

It ought to work this way:

C:\> mysql --auto-rehash
Or configure your 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.

update: The reason for this is mentioned briefly in 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.

Explanation: GNU readline is 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.

At one time in the past, the MySQL product provided an alternative client they called mysqlc.exe, which they compiled with the cygwin toolset 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.

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.

这是MySQL Windows版本的一个Bug :-)
分享到:
评论

相关推荐

    laravel-needs-auto-rehash:自动执行通用密码`Hash

    laravel-needs-auto-hash ... ...composer require samasend/laravel-needs-auto-rehash 基本用法 就是这样,您只需要安装软件包即可。 :rocket: 这是如何运作的? 这个神奇的程序包侦听的内置Illumi

    Mysql主从配置my.cnf.zip

    no-auto-rehash prompt="\u@\h [\d]>" #pager="less -i -n -S" #tee=/opt/mysql/query.log [mysqld] user = mysql basedir = /usr/local/mysql datadir = /data/mysql/mysql3306/data port = 3306 socket = /tmp/...

    ​深度学习之MySQL中的客户端选项.pdf

    - **--enable-auto-rehash**:此选项启用自动重哈希功能,允许自动补全数据库、表和列名。虽然默认情况下该功能已启用,但在某些版本中,可以通过特定选项来控制。 **应用场景**:对于提高开发效率,特别是当用户...

    mysql常用命令

    - `--auto-rehash`: 启用自动重哈希功能,使用户无需手动使用`rehash`命令即可获得表和字段的自动完成建议,但可能增加启动时间和重新连接时间。 - `--no-auto-rehash` 或 `-A`: 禁用自动重哈希功能,加快启动速度。...

    PHP程序设计-3期(KC016) 4.2MySQL登录拓展知识.doc

    例如,`-A, --no-auto-rehash`选项控制是否开启自动补全功能,这对于快速输入复杂的SQL语句非常有帮助。`-B, --batch`模式则禁用历史记录和交互,适合于自动化脚本执行。 字符集的设置是数据库设计中的关键部分。`-...

    mysql服务性能优化—my.cnf_my.ini配置说明详解(16G内存)

    - `no-auto-rehash`:禁用自动重新哈希功能,可以减少启动时的内存使用。 3. `[mysqld]`部分: - `user = mysql`:指定了MySQL服务运行的用户。 - `port = 3306`:与客户端配置相同,确保服务端和客户端使用相同...

    Mysql性能调优详解

    * no-auto-rehash:禁用自动hash功能 3.[mysqld]部分 * user = mysql:指定MySQL服务器的运行用户 * port = 3306:指定MySQL服务器的监听端口 * socket = /data/3306/mysql.sock:指定MySQL服务器的套接字文件 * ...

    基于VMware搭建开发环境06:安装mysql

    no-auto-rehash [client] port=3306 socket=/opt/mysql-5.7.39/run/mysql.sock [mysqld] basedir=/opt/mysql-5.7.39 datadir=/opt/mysql-5.7.39/data tmpdir=/opt/mysql-5.7.39/tmp lc_messages=zh_CN lc_messages...

    Centos5.6 x86_64下部署安装DRBD+Heartbeat+MySQL

    no-auto-rehash 四、结论 通过本文档,我们可以实现 Centos5.6 x86_64 操作系统下部署安装 DRBD+Heartbeat+MySQL 服务器平台,实现服务器平台的高可用性和高性能。同时,本文档还提供了一些有用的经验和建议,旨在...

    windows安装mysql.docx

    no-auto-rehash [client] socket=/tmp/mysql.sock ``` - 保存并关闭文件。 3. **初始化MySQL数据库**: - 打开命令提示符,切换到MySQL安装目录下的bin文件夹。 - 输入命令`mysqld --initialize-insecure`,...

    如何修改mysql字符集

    no-auto-rehash default-character-set=utf8 ``` 4. **重启MySQL服务使更改生效**: - 运行命令`/etc/init.d/mysql restart`重启MySQL服务。 5. **验证字符集设置**: - 登录MySQL服务器,执行`show variables ...

    【荐】mysql服务性能优化—my.cnf_my.ini配置说明详解(16G内存)

    - **no-auto-rehash**:禁用自动重哈希功能,可提高命令解析速度。该选项在交互式模式下特别有用,能减少因动态重哈希带来的性能损耗。 ##### 3. **[mysqld]** - **user=mysql**:指定MySQL服务启动时使用的用户...

    mysql安装.docx

    no-auto-rehash [mysqld] user=mysql port=3306 basedir=/usr/local/mysql datadir=/data/mysql/ socket=/tmp/mysql.sock character_set_server=utf8mb4 skip_name_resolve=1 open_files_limit=65535 ...

    Linux mysql tar包部署

    no-auto-rehash prompt="\\u@\\h:\\d> " ``` 2. **启动MySQL服务**:可以通过以下命令启动MySQL服务: ```bash /usr/local/mysql/bin/mysqld_safe & ``` 3. **连接MySQL并更改密码**:使用临时密码连接...

    MYSQL日常操作

    no-auto-rehash ``` 开启自动补齐功能: ```plaintext [mysqld_safe] pid-file=/u01/mysql/3306/run/mysqld.pid open-files-limit=10240 ``` 增加每个进程的可打开文件数量,以适应打开大量表的需求...

    my.cnf-调优

    - **no-auto-rehash**: 关闭自动哈希功能。 - **myisamchk**: MyISAM表检查工具配置。 - **key_buffer_size**: 类似于服务端配置。 - **sort_buffer_size**: 类似于服务端配置。 - **read_buffer**: 读取MyISAM...

    mysql数据库配置模板

    - **no-auto-rehash**: 禁用自动重哈希功能,可以减少命令输入时的提示信息。 ##### 3. [mysqld] MySQL服务器配置 - **user**: 指定运行MySQL服务器进程的系统账户。 - **port**/**socket**: 与`[client]`部分相同...

    mysql 常用设置 字符集编码、自动完成(自动提示)、监听外网ip

    这将开启自动完成的功能,取消注释掉之前的`#no-auto-rehash`。 3. **重启MySQL服务**: - 修改完配置文件后,同样需要重启MySQL服务使更改生效。通过命令`sudo /usr/local/mysql/support-files/mysql.server ...

Global site tag (gtag.js) - Google Analytics