Always access denied when attempting to tunnel into MySQL

Whenever I try to connect to MySQL through SSH I get the following error:

SQL Error (1045): Access denied for user 'root'@'localhost' (using password: YES)

I know that the username and password are correct. In the user table both "localhost" and "127.0.0.1" are allowed as hosts for root and the error message says it sees me as "localhost" so that shouldn't be the problem.

Right now my my.cnf is basically a copy of my-medium.cnf. I've tried all kinds of combinations of skip-networking and bind-address with no success. Could it be a problem in sshd_config?

2 Replies

Any weird characters in your password?

Not even necessarily 'weird' in terms of being whitespace or anything, difference between the terminal and remote character sequences could be giving you grief?

I've seen it happen before when we had a password that worked when copy/pasted but not when typed, was also MySQL, in that case over ssh in OSX terminal.

Options in PuTTY or whatever client you're using might allow you to find a way around it, but if you're after a quick fix a test of a plain alphanumeric ASCII password is probably a good way to start. :)

This only took 10 seconds to fix after some sleep. HeidiSQL has two tabs; one for the MySQL login and another for SSH. Someone how I missed that the SSH tab was still set to localhost and I was connecting to myself.

For some reason I do need bind-address explicitly set to 127.0.0.1 (or 0.0.0.0) in order to connect, even though the MySQL docs say that the default is to listen on all devices it doesn't seem to work (http://dev.mysql.com/doc/refman/5.0/en/ … nd-address">http://dev.mysql.com/doc/refman/5.0/en/server-options.html#optionmysqldbind-address).

Also despite conflicting info skip-networking does need to be commented out/disabled/set to 0. I doubt this is a security risk though if bind-address is set to 127.0.0.1.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct