PyMySQL can't connect to MySQL on localhost

后端 未结 8 1874
囚心锁ツ
囚心锁ツ 2020-11-28 08:26

I\'m trying to connect to MySQL on localhost using PyMySQL:

import pymysql
conn = pymysql.connect(db=\'base\', user=\'         


        
8条回答
  •  野性不改
    2020-11-28 08:40

    You need to add the port to the connection as well. Try this and it works fine.

    pymysql(Module Name).connect(host="localhost", user="root", passwd="root", port=8889, db="db_name")
    

提交回复
热议问题