My system:
- Windows 10 pro, version 1909 (build 18363.836)
- Anaconda version: conda 4.10.1
- Python 3.8.5 (python in conda env) and Python 3.9
- Jupyter Lab
- VS code
Hi! I hope you guys have a great day.
I have just installed mysql server and mysql workbench on my PC and I have some difficulties when I try to connect my python file to mysql database (I am using mysql workbench as the app) through "sqlalchemy". I have tried using VS code and Jupyter Lab, both of them yield the same result, nothing.
This is the code that I use:
import sqlalchemy as db
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
engine1 = db.create_engine('mysql+pymysql://root:12345@localhost:3306/sql_store')
con1 = engine1.connect()
meta = db.MetaData()
pd.read_sql('SELECT * FROM customers', con1, index_col='customer_id')
By the way, I have tried this code on my "Laptop" (not on my "PC") and it works well. I am a newbie in this field, so any suggestion would be fantastic since I have been dealing with this issue for days.
The error that I am getting is this:
OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Thanks a lot for your time!