简体   繁体   English

从Jupyter Notebook连接MySQLServer

[英]Connecting MySQLServer from Jupyter notebook

I wrote this piece of code to connect the MySQLServer from Jupyter notebook: 我编写了这段代码,从Jupyter笔记本连接MySQLServer:

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

在此处输入图片说明

pip list command also lists PyMySQL (0.9.2) . pip list命令还列出了PyMySQL (0.9.2)

Replace ' character to ' . 将“字符替换为”。

Here is new code: 这是新代码:

import sqlalchemy from sqlalchemy import create_engine 从sqlalchemy导入sqlalchemy导入create_engine

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM