Solution: Connecting MySQLServer from Jupyter notebook

Development | Programming languages
Author
Description
I wrote this piece of code to connect the MySQLServer from Jupyter notebook:
import sqlalchemy
from sqlalchemy import create_engine

engine = sqlalchemy.create_engine(‘mysql+mysqlconnector://root:password@localhost:3306/dbname?)

I am getting the following error:

File "<ipython-input-12-c958f7670e02>", line 6
    engine = sqlalchemy.create_engine(‘mysql+mysqlconnector://root:password@localhost:3306/events?)
                                           ^
SyntaxError: invalid character in identifier
Attachments
No attachments.
Solutions
Mysql isn't defined, and ‘ is not a valid apostrophe. Here is my code:

import sqlalchemy
from sqlalchemy import create_engine

engine = sqlalchemy.create_engine('mysql+mysqlconnector://root:password@localhost:3306/dbname')


on September 24th, 2018 (9:30 pm)
What masters said
You must sign in to comment!!
All comments
This solution has not been commented yet.
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept