connect with a user not @localhost

[expired user #7950]'s profile image [expired user #7950] posted 9 years ago in Creating a connection Permalink
Hi,

I use HeidiSQL to SSH Tunnel to MySQL on our remote servers. However, due to some new security restrictions, I now must tunnel to a server that has SSH access to the database - but that does not have the database local.

Long story short:
HeidiSQL only lets me put in a user the is like user@localhost. What I need is user@XX.XX.XX.XX. However, if I put in the User field user@XX.XX.XX.XX it then tries to connect with user@XX.XX.XX.XX@localhost. It automatically appends the @localhost.

Can you make it so that if @somethingelse is specified then it uses that rather than @localhost?

Thanks!
Joe
ansgar's profile image ansgar posted 9 years ago Permalink
The server, not HeidiSQL, adds this @hostname automatically. This is the hostname from where you connect from. For example, if your HeidiSQL and your MySQL server are both located on the same machine, MySQL will show @localhost (or @127.0.0.1). If you are connecting over the internet with some DSL or whatever connection, MySQL will see you as username@dsl-bla-ip-whatever.com .

So, you cannot set this hostname. It's just auto detected by MySQL. The reason for MySQL to use such a postfix is, that you can set privileges for users from specific hosts. You can for example with HeidiSQL's user manager, create one user bla@localhost and another bla@192.168.1.1 - the first user/client (HeidiSQL) then must be located on the same machine as the server, while the second user/client (HeidiSQL) must be located on a machine with the ip address 192.168.1.1 .

Makes sense?
[expired user #7950]'s profile image [expired user #7950] posted 9 years ago Permalink
Thanks, that makes sense and I now have it trying to connect with the correct user@hostname.

However...it still won't connect because that user requires SSL and the option to specify an SSL connection is not enabled when I use an SSH Tunnel. I have this setup in the exact same fashion in MySQL Workbench and it allows the SSL certs to be specified (and works), but I really prefer working in HeidiSQL :)

Thanks!

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