Using the below 3 PEM files I am able to connected successfully to a MySQL database on windows threw setting up a Data Source. (No problems here)
- client-key.pem
- client-cert.pem
- ca-cert.pem
But I also want to be able to connect via Python code on an Ubuntu server 10.04. I have Python and the MySQL Python Connector setup. But as expected fails trying to connect with the credentials alone since authorisation threw these PEM certificates are required.
**>>>** import mysql.connector
**>>>** cnx = mysql.connector.connect(user='odbc_user', password='mypassword',host='00.00.000.000',database='mydb')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/__init__.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/connection.py", line 95, in __init__
self.connect(**kwargs)
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/abstracts.py", line 719, in connect
self._open_connection()
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/connection.py", line 210, in _open_connection
self._ssl)
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/connection.py", line 144, in _do_auth
self._auth_switch_request(username, password)
File "/usr/local/lib/python2.6/dist-packages/mysql/connector/connection.py", line 177, in _auth_switch_request
**raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'odbc_user'@'hide.ec2' (using password: YES)**
**>>>**
What I have tried based on searches but with no progress:
- Copied the 3 .pem files to /usr/share/ca-certificates/ as .crt files.
- Ran
sudo update-ca-certificates
which added these to the /etc/ssl/certs/ca-certificates.crt file.
I'm no Linux guru and just trying anything I come across so if someone has done this before I would much appreciate the help.
mysql.connector.connect
.