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/mysqld/mysqld.sock' (2)”)
时间: 2024-10-23 17:56:54