将 Python 笔记本连接到 MySQL 数据库
Connecting Python notebook to MySQL Database
如何将 MySQL 数据库连接到我的 Jupyter notebook 以使用 Python notebook 执行查询?
我的代码:
import pymysql
conn = MySQLdb.connect(host=dsn_hostname, port=dsn_port, user=dsn_uid, passwd=dsn_pwd, db=dsn_database)
建立连接后如何开始执行查询?
文档里都写了:https://pymysql.readthedocs.io/en/latest/user/examples.html
import pymysql.cursorsenter
connection = pymysql.connect(host='localhost',
user='user_name',
password='password',
db='name_of_database',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor)
如何将 MySQL 数据库连接到我的 Jupyter notebook 以使用 Python notebook 执行查询?
我的代码:
import pymysql
conn = MySQLdb.connect(host=dsn_hostname, port=dsn_port, user=dsn_uid, passwd=dsn_pwd, db=dsn_database)
建立连接后如何开始执行查询?
文档里都写了:https://pymysql.readthedocs.io/en/latest/user/examples.html
import pymysql.cursorsenter
connection = pymysql.connect(host='localhost',
user='user_name',
password='password',
db='name_of_database',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor)