New feature: Launch command line window

ansgar's profile image ansgar posted 13 years ago in News Permalink
After having established a MySQL or MariaDB connection, HeidiSQL offers to launch a command line window (located in the "Tools" menu). This executes mysql.exe from the directory which is set in Tools > Preferences > Miscellaneous. The clue is that HeidiSQL passes all connection parameters from the current connection to that command line, including host/user/password, named pipes and SSL settings.



Although HeidiSQL is a pure GUI, there are situations in which you benefit from a text based window, without the myriad of GUI controls Heidi offers.

To get this feature, you just need to update to the latest build (Help > Check for updates).

See also issue #2728 for more details. Thanks to jsdeter for the idea!
1 attachment(s):
  • launch-command-window
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
Doesn't seem to work in Wine. My path is set to Z:\usr\bin (ie \usr\bin). When I choose "Launch command line" I get "Error: You need to tell HeidiSQL where your MySQL binaries reside, in Tools > Preferences > Miscellaneous". I'm using Heidi on Ubuntu 11.04, with Wine 1.4rc2
ansgar's profile image ansgar posted 13 years ago Permalink
Hm, well on Wine you likely do not have a "mysql.exe", which is searched for in HeidiSQL and if not you get the above error. I'll go and search for "mysql" if on Wine.
Code modification/commit 5c62ee5 from ansgar.becker, 13 years ago, revision 7.0.0.4074
Support Wine/Linux binary of mysql.exe in "Launch command line" feature. See issue #2728 and http://www.heidisql.com/forum.php?t=10158#p10162
ansgar's profile image ansgar posted 13 years ago Permalink
Fixed in r4074.
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
OK, no error now, and a message in the log window... but the command line app wasn't launched.

Message in log window:
/* Launching command line: Z:\usr\bin\mysql --host="127.0.0.1" --port=40281 --user="test" --password="********" --compress --database="test" */

Maybe Wine/linux launches apps differently?
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
BTW: amazingly fast response and turn-around! Awesome!
ansgar's profile image ansgar posted 13 years ago Permalink
Can you try to find out the right command line syntax? I guess I have to add some bash syntax but I'm confused with the Windows-style path "Z:\..."
ansgar's profile image ansgar posted 13 years ago Permalink
Oh, and good I have the password portion obscured - users tend to copy and paste stuff directly in forums - like you did above :)
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
In a bash shell:

/usr/bin/mysql --host="127.0.0.1" --port=40281 --user="test" --password="*********" --compress --database="test"

Works fine.
ansgar's profile image ansgar posted 13 years ago Permalink
Hm ok, this looks normal for a Linux system. I only see you selected "Z:\usr\bin\" as the path to your binaries, and I think I won't be able to automatically translate that path to /usr/bin/, am I? Probably the Z: drive on Wine is always prefixed?
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
I originally selected the path using the "Browse for folder" dialog.

Manually changing the path doesn't work either:

/usr/bin => /usr/bin\mysql
/usr/bin/ => /usr/bin/\mysql
ansgar's profile image ansgar posted 13 years ago Permalink
Yes, Heidi does not support native Linux calls yet. But I found some Wine help for winepath here: http://wiki.winehq.org/winepath

They say:

To launch documents from inside Windows apps, create a small shell script called e.g. /usr/bin/run_prog containing

#!/bin/sh
$1 "`wine winepath -u "$2"`"



If we don't want to create a shell script first, how should the command line look like using winepath? And, do all Wine users have winepath also or is that installed separately?
ansgar's profile image ansgar posted 13 years ago Permalink
r4075 now
* disables the "browse for folder" dialog, so the user does not get a Windows-style path, instead he gets forced to write the path syntax by hand
* adds the right directory separator depending on Windows/Wine

There is a chance that the ShellExecute method does not succeed for some reason, but you could test again now, using /usr/bin as setting. Should not matter if you add or remove a trailing slash.
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
I've just updated to build 4078 and the command line stuff is still not working correctly.

I tried just using /usr/bin as the path. Then I tried adding the script /usr/bin/run_prog but that didn't work either.
ansgar's profile image ansgar posted 13 years ago Permalink
Hm I don't know how to fix that. I'm just calling a ShellExecute() with your path /usr/bin/ and "mysql" as the command itself. No clue what's wrong here. Think we need deeper Wine knowledge here.
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
Does this help?
http://wiki.jswindle.com/index.php/Advanced_Wine_User_Information#Running_Linux_software_From_Wine
kalvaro's profile image kalvaro posted 13 years ago Permalink
It's an interesting feature I had never imagined but which I'll definitively use. Well thought!

Just an idea: it'd be perfect if it could find mysql.exe automatically. Microsoft has documented how to find an application [1]. The version of MySQL that's currently installed in my computer does not follow the recommended method but at least has modified the system's PATH.

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx
ansgar's profile image ansgar posted 13 years ago Permalink
cjunge: The docs only say you can create a separate script - did you read that? I don't think that Heidi should go so far and create a bash script with the path to mysql from settings, and finally launch that script. But you could create your own script like described there and save it as "mysql" somewhere, then tell Heidi the path to that directory, so HeidiSQL does not start the mysql executable, but the script called mysql.
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
I might've found a solution:

$TERM -e /usr/bin/mysql --host="127.0.0.1" --port=40281 --user="test" --password="********" --compress --database="test"

Alternative is not to specify /usr/bin at all, and it'll use the default one in the system (using PATH).

$TERM should always be specified & I assume that -e will always be the flag to use to run the command.

Hopefully that helps.
jfalch's profile image jfalch posted 13 years ago Permalink
my $TERM is set to xterm, which is not installed on my debian server system. One should probably use
$SHELL -l -c ...
instead of
$TERM -e ...
on non-X systems, or generally those where
which $TERM
returns $? > 0.

Also, $SHELL -l -c `which mysql` could be helpful.
[expired user #5286]'s profile image [expired user #5286] posted 13 years ago Permalink
jfalch: I assumed that WINE needs to run on a system with X, so assumed that $TERM would work.

Your suggestion might be safer.
ansgar's profile image ansgar posted 13 years ago Permalink
Ok, I'll try the $SHELL approach.
jfalch's profile image jfalch posted 13 years ago Permalink
please disregard my last comment. cjunge is right: when you are running heidisql on a linux system, you are running it under wine; wine needs X; when X is installed, $TERM will be set to a meaningful value, so you should use $TERM -c.
The above-mentioned situation ($TERM points nowhere) is a rare, negligible special case when running X.
ansgar's profile image ansgar posted 13 years ago Permalink
So, $TERM -c is it, or $TERM -e as noted above ?
jfalch's profile image jfalch posted 13 years ago Permalink
Bother, mistyped. Not my day. Should be $TERM -e as in cjunge´s original post - cf man xterm (search for -e).
Code modification/commit ccca1bf from ansgar.becker, 13 years ago, revision 7.0.0.4080
Try to fix command line for Wine users by launching "$TERM -e path/to/mysql", see http://www.heidisql.com/forum.php?t=10158
ansgar's profile image ansgar posted 13 years ago Permalink
Done in r4080 . I guess this is hopeless - $TERM must now get passed by ShellExecute which may be a new problem.. don't know, please test.
[expired user #9862]'s profile image [expired user #9862] posted 9 years ago Permalink

Hello, it doesn't work here. I put /usr/bin/mysql as path to mysql, so when I try to start MySQL in a console I get the following message (in the bottom log panel) : / Lancement de la ligne de commande : $TERM -e /usr/bin/mysql --host="127.0.0.1" --port=3306 --user="root" --database="AgPrep" / and nothing more happens. It seems, with recent versions of Wine, Unix programs should be launched by means of start.exe, e.g. : start /unix /usr/bin/konsole launches a KDE console from the Wine terminal.

ducpham's profile image ducpham posted 5 years ago Permalink

Hi guys, I am a bit new to this. I just installed MYSQL Installer at https://dev.mysql.com/downloads/windows/installer/8.0.html but checking the download folder on Windows 10, I get this:

image description

I do not see any mysql.exe here or when searched on Windows Search function.

Do I have to install some other MySQL software?

kalvaro's profile image kalvaro posted 5 years ago Permalink

Mine is at C:\Program Files\MySQL\MySQL Server 8.0\bin.

ducpham's profile image ducpham posted 5 years ago Permalink

Thanks! I needed to have additional plugin before I can install MySQL Server

jfalch's profile image jfalch posted 5 years ago Permalink

Install "MySQL Installer" which should offer to install MySQL Server, which when done will contain the mysql client (mysql.exe) in its bin directory.

Please login to leave a reply, or register at first.