Two guesses:
-
Run
mysqladmin variables | grep socketto get where the socket is located, and try setting up a connection like so:pymysql.connect(db='base', user="root", passwd='pwd', unix_socket="/tmp/mysql.sock") -
Run
mysqladmin variables | grep portand verify that the port is 3306. If not, you can set the port manually like so:pymysql.connect(db='base', user="root", passwd='pwd', host="localhost", port=XXXX)