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

Command line parameters not recognized correctly

thomas.k posted 1 year ago in General
Hi,
After upgrading to 8.1.0.4545 parameters are not recognized correctly any more when calling HeidiSQL via command line (Ubuntu/Wine). HeidiSQL in my case always tries to connect with user root@localhost whenever a parameter (any parameter) is submitted.

E.G.
wine C:\\Programme\\HeidiSQL\\heidisql.exe -user=xxxx -password=yyyy -P=3310

results in SQL error 1045 "Access denied for user 'root'@'localhost' (using password: YES)"

Same if -user is the only parameter submitted.

Everything worked fine in earlier versions used with Wine and Linux.

Thank you.
Thomas
ansgar posted 1 year ago
So, you even get connected to localhost when passing a hostname with -h or --host ?

Most probably caused by r4509 if that's true.
thomas.k posted 1 year ago
I want to connect to localhost. But, if I pass another hostname that is not existing, result is an SQL error 2003 "Can't connect to MySQL server...". - So the host-parameter is used, answer to your question is no.
jfalch posted 1 year ago
workaround: define a session in heidisql´s session manager with the appropriate host, user and password; then use -d=storedSessionName - works fine her with latest (4572)
ansgar posted 1 year ago
I just look into the Heidi code, and I see that previously there was a mixture of short and long parameter names. Now, or more exactly since r4509, you cannot use a single dash + a long parameter name. For example, "user" is the long name where "u" is the short one.

So, you should be able to fix your problem by prepending one more dash to your "user" parameter (and "password" also):

wine C:\\Programme\\HeidiSQL\\heidisql.exe --user=xxxx --password=yyyy -P=3310
thomas.k posted 1 year ago
Using one (for short) or two dashes (for long parameter names) makes no difference and does not fix the issue. Same results for
wine C:\\Programme\\HeidiSQL\\heidisql.exe --user=xxxx --password=yyyy
wine C:\\Programme\\HeidiSQL\\heidisql.exe -u=xxxx -p=yyyy

The workaround does not solve my problem, because I want to call HeidiSQL from KeePass to avoid updating credentials in the session manager. (Indeed, I could easily use the session manager to open the connection, no need for command line than. Or downgrade to 8.0 again.)

Unfortunately, there seems to be no executable 8.1 prior to r4509 so that I could verify that this revision is causing the issue.

ansgar posted 1 year ago
Nah, if it's a bug then let me fix that. Just give me some time for doing that. I'll just try it out here at work and let you know if I can reproduce that.
ansgar posted 1 year ago
No, I can connect perfectly here, using such a commandline:

heidisql.exe -hIP -uxxx -pxxx



But the difference is, I am not on Wine but on a Windows 7 box. So, I can just guess that

Windows.GetCommandLine


does not work on Wine as on Windows.

This thread is everything I find related to the GetCommandLine function on Wine, but in a different context. Probably you find something more useful here?
ansgar posted 1 year ago
I meant this thread: http://www.winehq.org/pipermail/wine-devel/2002-October/009394.html
thomas.k posted 1 year ago
What I found out so far: The first argument seems to be ignored. If I specified h=localhost (which is default) in first place, everything looks fine:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -h=localhost -u=xxxx -p=yyyy -P=3310 (connects)

If user is specified in first place, it obviously is ignored, root@localhost is used instead (which is default):
wine C:\\Programme\\HeidiSQL\\heidisql.exe -u=xxxx -p=yyyy -P=3310 (does not connect - as described)

If rootpasswd is submitted with example above, the connection for root is established:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -u=notroot -p=rootpasswd (connects as root!)

If a dummy parameter is specified in first place, all other parameters are interpreted as expected:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -z=foobar -u=xxxx -p=yyyy -P=3310 (connects)

Does that make any sense?

(I found the wine thread you're refering to. It's old, isn't it? Anyhow, it shows that wine developers do know Windows.GetCommandLine...)

ansgar posted 1 year ago
Makes sense. I suspect the regex requiring a space where there is none. Will check.
peperfus posted 8 months ago

thomas.k wrote: What I found out so far: The first argument seems to be ignored. If I specified h=localhost (which is default) in first place, everything looks fine:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -h=localhost -u=xxxx -p=yyyy -P=3310 (connects)

If user is specified in first place, it obviously is ignored, root@localhost is used instead (which is default):
wine C:\\Programme\\HeidiSQL\\heidisql.exe -u=xxxx -p=yyyy -P=3310 (does not connect - as described)

If rootpasswd is submitted with example above, the connection for root is established:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -u=notroot -p=rootpasswd (connects as root!)

If a dummy parameter is specified in first place, all other parameters are interpreted as expected:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -z=foobar -u=xxxx -p=yyyy -P=3310 (connects)

Does that make any sense?

(I found the wine thread you're refering to. It's old, isn't it? Anyhow, it shows that wine developers do know Windows.GetCommandLine...)



Thomas, I have had a similar problem.
Read my thread. I solved it by adding more than just a single space between command (heidisql.exe) and parameters (-h=...)
http://www.heidisql.com/forum.php?t=15082#p15113
peperfus posted 8 months ago
Try it and comment if it works for you too ?

Sorro for bad english.
thomas.k posted 8 months ago
I'm sorry, your solution does not work in this case.
Thank you.
Thomas
ansgar posted 8 months ago
thomas.k, are you sure you're using a newer HeidiSQL version? I worked on that code some months ago, so... just to be sure.

Then, I still do not know what Wine returns by Windows.GetCommandLine. It could be that "wine" is param 0, "C:\\Programme\\HeidiSQL\\heidisql.exe" is param 1, "-h=localhost" is param 2, and so on. Difficult to test. But I can probably add a debug log item with what Windows.GetCommandLine returns, then you activate Tools > Preferences > Logging > Debug messages, and you see what we have then.
thomas.k posted 8 months ago
Hi Ansgar, we can do this debugging if you like. But if you are short of time, the workaround described above is sufficient. I just wanted to confirm that multiple spaces do not work in this case. I'm using 8.3.0.4694 right now.
Cheers. Thomas
ansgar posted 8 months ago
So you just have the same multiple-space-problem as peperfus? If so, we don't need to debug that. I will just modify Heidi to accept more than one space between parameters.
thomas.k posted 8 months ago
No. I rather tried to say that the issues were not related. The workaround I was refering to is this one:

If a dummy parameter is specified in first place, all other parameters are interpreted as expected:
wine C:\\Programme\\HeidiSQL\\heidisql.exe -z=foobar -u=xxxx -p=yyyy -P=3310 (connects)

So it has to do with params' count, order, and/or interpretation.
ansgar posted 8 months ago
That sounds exactly like the other issue. The issue was that a space was missing in front of the first parameter. No matter if you specify a dummy parameter or inject a second space - both workarounds fix that.

I have fixed that issue permanently in r4727
thomas.k posted 8 months ago
I can confirm that on Wine the issue is fixed in r4727. Thanks for your effort.

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