So I have set-up a mySQL database and am trying to connect to it from Python. Unfortunately the Jupyter kernel keeps dieing if I try to connect. I don't have much to go on given I don't get an error message either, but this is the code I use (although I have tried SQLalchemy and pyodbc as well):
import mysql.connector
cnx = mysql.connector.connect(user='root', password='test',
host='localhost',
database='testdb')
cnx.close()
I am assuming it is something in my set-up/access but I have limited experience with SQL. I tried to do the troubleshooting suggested in some other questions but to no avail. I checked the session details in MySQL workbench and they are the same. I have also added the disable SSL statement (given it says in the session details SSL is not used) but again no change.
Hope you can help with the limited info I supplied/have.
rootto connect from%(any host), but avoid this on production systems for security reasons.GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'test'; FLUSH PRIVILEGES;mysql -u root -p test testdbfrom the command line? This would show if you can connect to server.