Accessing a XAMPP mysql via Python

后端 未结 3 1623
爱一瞬间的悲伤
爱一瞬间的悲伤 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:02

    Have the same issue using and look for your SQL configuration file my.cnf.

    # The following options will be passed to all MySQL clients
    [client]
    #password   = your_password
    port        = 3306
    socket      = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
    

    and use socket as parameter:

    mysql://read:read@localhost/phonehome?unix_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
    

    In my case:

    app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://read:read@localhost/phonehome?unix_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'
    

提交回复
热议问题