Automatic completion of MySQL commands

Source: Internet
Author: User
Tags mysql commands rehash
The MySQL command auto-completion function has been known for the past few days (MySQL has been used for several years, and now I know it is really embarrassing), but it is not enabled by default. To enable this function

The MySQL command auto-completion function has been known for the past few days (MySQL has been used for several years, and now I know it is really embarrassing), but it is not enabled by default. To enable this function

I have known the MySQL command (command) Auto-completion function in the past few days (MySQL has been used for several years, but now I know it, I am so embarrassed)

But it is not enabled by default. To enable this function, you can

Vi/etc/my. cnf

[Mysql]

# No-auto-rehash

Auto-rehash # Add auto-rehash

Change no-auto-rehash in [mysql] to auto-rehash.

Login to MySQL again will be able to automatically complete.

If you want to try the same in Windows, you will find that it will not succeed.

The reason is explained in the following English:

It ought to work this way:

Or configure your my. cnf:

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] 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 des 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 cocould download the cygwin toolset including the readline library, then download the MySQL source code and build it using cygwin. then you shoshould 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.

This is a Bug in MySQL Windows :-)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.