mycli icon indicating copy to clipboard operation
mycli copied to clipboard

Access denied for user

Open chientranthien opened this issue 6 years ago • 7 comments

I was trying to connect a remote mysql server. and I got this message

(1045, u"Access denied for user 'oms-dev'@'10.1.9.18' (using password: YES)"

following is mysql server connection information

Connection id: 2996639 SSL: Cipher in use is DHE-RSA-AES256-SHA Current pager: less Using outfile: '' Using delimiter: ; Server version: 5.7.22-log Source distribution Protocol version: 10 Connection: 127.0.0.1 via TCP/IP Server characterset: latin1 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port: 3307 Uptime: 248 days 20 hours 11 min 23 sec

chientranthien avatar Jul 30 '19 02:07 chientranthien

Hello @chientranthien! It looks like you're using SSL on the mysql client. Can you provide the command you're using to connect with mycli? Thanks!

tsroten avatar Jul 30 '19 11:07 tsroten

@tsroten I created a tunnel and connect to MySQL server via that tunnel

mycli -h localhost -P 3307 -u test_user -p test_db

chientranthien avatar Jul 31 '19 03:07 chientranthien

@chientranthien Thanks! So, you're using a tunnel -- that's great, it looks like specifying the port should work fine for that.

So, I believe that mycli is interpreting test_db as the password. Instead, just don't pass -p and mycli will prompt you for the password:

mycli -h localhost -P 3307 -u test_user test_db

Another thing to try

If that doesn't work, I think we'll want to try to see if you can connect using mysql without any configuration files (to rule out an additional configuration that is not being passed to mycli): mysql --no-defaults -h localhost -P 3307 -u test_user -p test_db

If that doesn't work, then there is likely some configuration you've set up for mysql that we also need to set up for mycli. You could check your ~/.my.cnf file as a starting point.

tsroten avatar Aug 04 '19 11:08 tsroten

Hi @chientranthien, any luck with this?

tsroten avatar Aug 09 '19 12:08 tsroten

@tsroten

I can't access remote MySQL event I tried to input password from prompt

mycli -h localhost -P 3307 -u test_user test_db

below command work fine. I can access remote MySQL

mysql --no-defaults -h localhost -P 3307 -u test_user -p test_db

chientranthien avatar Aug 11 '19 08:08 chientranthien

@chientranthien The next steps I would try if I were you are:

  1. Configure mycli to use SSL like the mysql client was doing. The official client will automatically establish an encrypted connection if the server supports it. I don't think mycli does this.
  2. You could turn debug logging on in mycli to verify that the connection information being sent matches what you expect.

tsroten avatar Aug 11 '19 21:08 tsroten

@tsroten is SSL still not supported by default? there is no way for mycli to connect to a server which only accepts SSL connections!

karakays avatar May 07 '21 19:05 karakays