Accessing a XAMPP mysql via Python

后端 未结 3 1614
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-09 08:24

I\'m attempting to use mysql after only having worked with sqlite in the past.

I\'ve installed XAMPP on Linux (ubuntu) and have mysql up and ru

3条回答
  •  别那么骄傲
    2021-02-09 09:04

    For the record (and thanks to a pointer from Igancio), I found that the below works (terrible I didn't think of this before):

    db=MySQLdb.connect(
       user="root"
      ,passwd=""
      ,db="my_db"
      ,unix_socket="/opt/lampp/var/mysql/mysql.sock")
    

提交回复
热议问题