[GRASS-user] MySQL mysql.sock GRASS connection problem
Glynn Clements
glynn at gclements.plus.com
Sat Sep 27 20:29:00 EDT 2008
Mark Ruddy wrote:
> I am having problems connecting to a local MySQL db from GRASS.
>
> using the following commands i get the error below...
>
> > db.connect driver=mysql database=dbname
> > db.login user=user pass=password
> > db.tables -p
> DBMI-MySQL driver error:
> Cannot connect to MySQL: Can't connect to local MySQL server through
> socket '/tmp/mysql.sock' (2)
>
> A far as I was aware this is general error to do with some
> installations of MySQL placing mysql.sock somewhere else other than /
> tmp. I encountered this before when trying to connect another MySQL
> client (R) and easily solved the problem by editing the /etc/my.cnf
> file to contain the true [client] location of mysql.sock. GRASS
> seems to be ignoring the /etc/my.cnf file though and seems to be
> still trying to locate mysql.sock in /tmp. All my other MySQL clients
> don't have a socket problem. Does GRASS take its MySQL global configs
> from some other location? Is something else wrong? Any help would be
> greatly appreciated.
>
> I'm running GRASS 6.2.1 courtesy of OpenOSX on Mac OSX 10.4.11 with
> MySQL 5.0.19.
The MySQL driver never tries to force the use of a specific socket
path.
It connects using:
res = mysql_real_connect ( connection, connpar.host, user, password,
connpar.dbname, connpar.port, NULL, 0);
[ http://trac.osgeo.org/grass/browser/grass/tags/release_20061212_grass_6_2_1/db/drivers/mysql/db.c ]
If you specify just a database name to db.connect, connpar.host will
be NULL, which will cause it to use a Unix-domain socket. The
unix_socket parameter is always NULL, which causes the client library
to use the default socket path.
[ http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html ]
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list