Skip to content

Latest commit

 

History

History

PyMySql連線mySQLServer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

PyMySql連線mySQLServer

安裝PyMySql

安裝PyMySql

$ pip install PyMySQL

連線mySQLServer

  • 使用Sequel Pro的 Database -> View UsingEncoding檢查編碼

import pymysql.cursors
connection = pymysql.connect(host='localhost',
                             user='root',
                             password='12341234',
                             database='world',
                             charset='utf8mb4',                             cursorclass=pymysql.cursors.DictCursor)
with connection:
    print(connection)
    print("連線成功")