OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysql相关的知识,希望对你有一定的参考价值。

OperationalError: (2002, “Can‘t connect to local mysql server through socket ‘/var/run/mysqld/mysqld.sock‘ (2)”)

python MySQLdb这个模块是独立的,有自己独立的socket,解决的方法就是找出mysql配置里的socket的地址(比如socket=/tmp/mysql.sock),然后做个软连接

ln -s /tmp/mysql.sock  /var/run/mysqld/mysql.sock 

以上是关于OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysql的主要内容,如果未能解决你的问题,请参考以下文章

Django / Docker-compose:重试数据库连接时:django.db.utils.OperationalError:(2002,“无法连接到'db'(115)上的MySQL服务器”)

OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysql

FLASK python web:MySQLdb._exceptions.OperationalError:(2002,“无法通过套接字'/tmp/mysql.sock'连接到本(代码

如何保留多个 MySQL 实例

sqlalchemy.exc.OperationalError:(sqlite3.OperationalError)没有这样的表:mytable

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2059, "Authentication pl