Is it possible to use Mysql with SqlAlchemy and Flask if my mysql socket isn't in /tmp?

后端 未结 3 1797
遇见更好的自我
遇见更好的自我 2020-12-16 13:07

The location for mysql.sock on my system is /usr/local/mysql5/mysqld.sock

thrilllap-2:tmp reuven$ mysqld --print-defaults
mysqld would have          


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 14:00

    You'll have to dig up the exact syntax, but for MySQL I think they use a unix_socket query opt. Something like:

    mysql:///dbname?unix_socket=/opt/mysql/mysql.sock'
    

    Should be your connect URI for SQLAlchemy.

提交回复
热议问题