Access denied for user
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
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 I created a tunnel and connect to MySQL server via that tunnel
mycli -h localhost -P 3307 -u test_user -p test_db
@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.
Hi @chientranthien, any luck with this?
@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 The next steps I would try if I were you are:
- 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.
- You could turn debug logging on in mycli to verify that the connection information being sent matches what you expect.
@tsroten is SSL still not supported by default? there is no way for mycli to connect to a server which only accepts SSL connections!