Cant connect with command line. GUI connects ok

[expired user #7839]'s profile image [expired user #7839] posted 10 years ago in Creating a connection Permalink
Hello

First, thank you for this wonderful mysql client. I'm considering making a donation. I will if you solve my problem.

Sorry for bad english.

I am trying to connect with command line to my remote server.
All parameters are OK
user ok
password ok
host ok
port ok

When I use GUI, connects ok, it works perfect.
But using command line fails:
Cant connect to mysql server on '127.0.0.1' (10061)

Also, Don't understand why it tries to connect to localhost, when I specified -h=remoteserverurl.com (also tried -h=remoteserverIP).

My heidisql is latest. I have read several solutions, but none worked for me or didn't understand. I don't use "plink.exe" (neither know what it is...), In GUI, I use normal connection.

Thank you

Thank you.
kalvaro's profile image kalvaro posted 10 years ago Permalink
You apparently have a bogus = sign. The valid syntax is:

--host=host_name, -h host_name


To make this off-topic, Tools-> Launch command line will connect automatically for you.
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
I am trying to connect with command line for adding an entry to KeePass.

Windows command line (cmd):
heidisql.exe -h abcd.com -u user -p pwd -P port

still same error.

If I use such parameters in GUI, connects ok.

I am using windows xp
No mysql installed.

Still don't understand why tries to connect to 127.0.0.1 instead of abcd.com



Thanks for your help
ansgar's profile image ansgar posted 10 years ago Permalink
I get "Can't connect to MySQL server on 'abcd.com' (10060)" with your command line.

Please check which version of HeidiSQL you are running. I recall there was a bug which I fixed not so long ago. Updating to the latest release or build could fix your problem.
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
Hello

I have tried something curious...
I have tried the same in an oracle vm virtualbox and it works from command line.
It must be some of my windows xp config or anything... firewall config or anything that doesn't let heidisql command line connect to remote host.

I keep testing till guess what is the matter and when I solve it I will post it.
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
Ok, this is madness.

I have renamed my.ini of my wamp to my.ini.bak.
Try... WORKS OK.
Rename my.ini.bak to my.ini, Try... WORKS.
Try the latest portable version: WORKS
Try the latest installed version: WORKS.

Don't understand anything. Why works now and what solved the matter. MADNESS.

Try on my buddy computer... Doesn't work.
rename his my.ini to my.ini.bak
(wamp was allways stopped (all services down) in ALL cases)
Doesn't work.
Firewall --> OFF
Doesn't work.

Madness.

Now it works on my computer. Doesn't work on his.
Worst of all is We don't know what solved the problem on mine.

Any suggestion to help clarify this mistery ?
ansgar's profile image ansgar posted 10 years ago Permalink
You did not read my notice about updating HeidiSQL?
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
Hello, Yes, I read it. But I had already the latest version. Anyway I downloaded again it and installed and it kept failing.

Listen !!

I FOUND What makes it WORK !! and you won't believe it.

executing this:
heidisql.exe [parameters] DOESN'T WORK

BUT !!

executing:
heidisql.exe [parameters] WORKS PERFECT.
(more than 1 white space between heidisql.exe and [parameters])

heidisql [parameters] also works.
(five spaces between command and parameters)

I got crazy till I found this solution, but this is what works for me and my buddy.

Review your source code, ther part where you catch arguments string. It seems you cut some characters...
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
forum code cut the spaces.

I meant:

heidisql.exe__[parameters]
(2 spaces)
and
heidisql_____[parameters]
(5 spaces)
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
GREAT program, anyway. Very satisfied with it.

I just made a 5€ donation.

Thanks and continue making HeidiSQL better.
ansgar's profile image ansgar posted 10 years ago Permalink
Oh... multiple spaces. I should fix that.
ansgar's profile image ansgar posted 10 years ago Permalink
This seems to be a WinXP issue, along with Windows.GetCommandLine. On Win7, there is no requirement for more than 1 space.
Code modification/commit from ansgar.becker, 10 years ago, revision 8.3.0.4727
Windows.GetCommandLine provides two spaces between exename and first parameter, only on Win7, but not on WinXP. The two on Win7 were cut to one, and the one on XP was cut to 0, where the regex required a mandatory space. See http://www.heidisql.com/forum.php?t=15082
ansgar's profile image ansgar posted 10 years ago Permalink
Fixed in r4727
ansgar's profile image ansgar posted 10 years ago Permalink
See also: http://social.msdn.microsoft.com/Forums/vstudio/en-US/5e737981-3ce1-4742-aa84-9d3f8c7a6b1d/getcommandline-space-problem-in-windows-2008?forum=vclanguage
[expired user #7839]'s profile image [expired user #7839] posted 10 years ago Permalink
Perfect smile

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