Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

  (email not shown publicly)

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Wednesday April 22, 2009
09:38 AM

Setting up mysql client on Cygwin

[ #38844 ]

I'm running Windows MySQL server, but I'm doing an increasing amount of my development work from Cygwin (thankfully). Unfortunately, to get maximum benefit out of Cygwin I want to be doing my work from xterms, and the Windows MySQL client expects to run under the Windows console. I really don't want to launch Windows consoles with Cygwin bash just for MySQL (or anything else, for that matter), and I don't want to limit myself to CMD, so I wanted to use a Cygwin-native MySQL client.

To compile the client, I had to pass --without-server and --without-libedit to ./configure . The first option's meaning is obvious. The second seems confusingly-named to me: it directs MySQL to compile using libedit already installed on the system instead of compiling libedit from source bundled in its source tree. The option does not mean you won't get command-line history or anything. In fact, command-line history works beautifully and is much more preferable to what I get from the Windows MySQL client.

After installation, the client wants to connect through a local socket. I doubt that this can be made to work from Cygwin to Windows MySQL server, but I suppose it might be as simple as needing to direct the client to look for the socket somewhere besides /tmp/mysql.sock (C:\cygwin\tmp\mysql.sock) or making a symlink. My approach instead is to tell the client to connect with TCP:

mysql --protocol=tcp

This of course is inconvenient to type every time, so I put it in ~/.my.cnf . (I used strace on the failing mysql client to determine the potential locations for my.cnf were: /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, and $HOME/.my.cnf .) The my.cnf syntax is:


Googling revealed that it was also possible to force the client to connect with tcp by telling it to use as the host. Mysteriously, this does not work when the host is specified as localhost.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.