0

I want to connect to a readonly MySQL-DB to my Django WebAPP. Using Django, MySQL-Workbench or MySQL-Shell always resulted in the same error:

ERROR 1045 (28000): Access denied for user 'db-foo-read'@'125.67.891.26' (using password: YES)

I was able to connect via HeidiSQL-Client using the same configurations, but only if the library is set to libmysql-6.1.dll enter image description here

Choosing a different .dll always resulted in the same Error 1045 (28000) : Access denied...

Django Database Settings:

'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'db-foo',
    'USER': 'db-foo-read',
    'PASSWORD': 'djlkwajldljwj1ldwa1',
    'HOST': '125.67.891.26',
    'PORT': '3306',
},

What i tried:

  • Connect with Shell: "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" --user="db-foo-read" --password="djlkwajldljwj1ldwa1" --ssl-mode=DISABLED --host="125.67.891.26" --port=3306 --protocol=tcp

  • changing the libmysql.dll @ C:\Program Files\MySQL\MySQL Server 8.0\lib to the HeidiSQL libmysql-6.1.dll

  • I tried following python libraries: pymysql, mysql, MySQLdb, mariadb

2 Answers2

1

This is version skew, having to do with the way the client library .dll sends password information to the server. When do I use libmysql-6.1.dll vs libmysql.dll?

Ansgar Becker (HeidiSQL's author) includes several different libraries, because his end-users (like me) often need to connect to several different MySQL and MariaDB versions.

Try reinstalling your Windows client MySQL packages including the python connector. https://dev.mysql.com/downloads/connector/python/

Using the MariaDB versions of the client packages will probably also work.

O. Jones
  • 103,626
  • 17
  • 118
  • 172
0

Solution was downgrading the mysql version to support old the tls-protocol versions 1.1 and 1.2

Also adding the parameter

--tls-version="TLSv1.1,TLSv1.2"

to the command seems to fixed the Issue. Reason was that the DB was using an old Version of MongoDB which only supported these old protocols.

For anyone having the same Issue, here's a table of all MySQL-Versions with the supported tls protocols: https://dev.mysql.com/doc/refman/8.0/en/encrypted-connection-protocols-ciphers.html