I manage to establish a connection to a remote mysql server with pycharm's database feature.
1. View > Tool Windows > Databases
2. Click on +
3. Navigate to SSH/SSL
4. Insert ssh details
5. Test connection
The test connection works with the below message:
DBMS: MySQL (ver. 8.0.21) Case sensitivity: plain=exact, delimited=exact Driver: MySQL Connector/J (ver. mysql-connector-java-8.0.21 (Revision: 33f65445a1bcc544eb0120491926484da168f199), JDBC4.2) Ping: 210 ms SSL: yes
Now that I am connected to the mysql database via ssh I should be able to connect and run queries via a python script like so:
config = {
'user': 'jsadmin',
'password': 'password',
'host': 'localhost',
'database': 'mmdb',
'port': 3306,
'raise_on_warnings': True,
}
conn = mysql.connector.connect(**config)
The above is giving me an error:
mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'jsadmin'@'localhost' (using password: YES)
Why is there this error If I can run queries with the above credentials from pycharm's database console?
Edit
even having the same version of the mysql-connector-python
to mysql server still produced the same issue
The question is once I shh from pycharm's data source properties window, is the server ip
now localhost
from python code?