distal-attribute
distal-attribute
distal-attribute
distal-attribute

New feature: Launch command line window

ansgar posted 3 years ago in News
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!
cjunge posted 3 years ago
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 posted 3 years ago
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.
ansgar posted 3 years ago
Fixed in r4074.
cjunge posted 3 years ago
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?
cjunge posted 3 years ago
BTW: amazingly fast response and turn-around! Awesome!
ansgar posted 3 years ago
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 posted 3 years ago
Oh, and good I have the password portion obscured - users tend to copy and paste stuff directly in forums - like you did above :)
cjunge posted 3 years ago
In a bash shell:

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

Works fine.
ansgar posted 3 years ago
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?
cjunge posted 3 years ago
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 posted 3 years ago
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:

WinePath wrote: 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 posted 3 years ago
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.
cjunge posted 3 years ago
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 posted 3 years ago
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.
cjunge posted 3 years ago
Does this help?
http://wiki.jswindle.com/index.php/Advanced_Wine_User_Information#Running_Linux_software_From_Wine
kalvaro posted 3 years ago
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 posted 3 years ago
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.
cjunge posted 3 years ago
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 posted 3 years ago
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.
cjunge posted 3 years ago
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 posted 3 years ago
Ok, I'll try the $SHELL approach.
jfalch posted 3 years ago
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 posted 3 years ago
So, $TERM -c is it, or $TERM -e as noted above ?
jfalch posted 3 years ago
Bother, mistyped. Not my day. Should be $TERM -e as in cjunge┬┤s original post - cf man xterm (search for -e).
ansgar posted 3 years ago
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.

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