Question

When I connected to mysql using clsql,the following error occurred

While trying to connect to database localhost:3306/root/ using database-type MYSQL: Error 2002 / Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) has occurred. [Condition of type SQL-CONNECTION-ERROR]

My mysql.sock path is "/home/myhome/var/run/mysql/mysql.sock",how can I change the default sock path in clsql? Here is my code, (SBCL 1.0.50 ,mysql 5.0,clsql-20130128-git)

(asdf:operate 'asdf:load-op 'clsql)

(in-package #:clsql-user)

(clsql:connect '("localhost" "username" "password" "dbname" 3306 ) :database-type :mysql)"

No correct solution

OTHER TIPS

I would suggest creating a ~/.my.cnf or (if you have root access) /etc/my.cnf file and including a client setting for the socket, libmysqlclient might pick this up.

Failing that (or if you don't want to make a global change) the doc suggests you can specify a list of MySQL options as a separate assoc list http://clsql.b9.com/manual/connect.html which get passed into mysql_options()

Funny,the answer is that change the host from "localhost" to "127.0.0.1"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top