soledad penadés
repeat 4[fd 100 rt 90]

Wrong location of mysql.sock?

I was trying to run bake script (for cakephp!) and it started complaining about not finding /var/mysql/mysql.sock - but why this path? I already had problems with mysql socket and ruby on rails. In that time, I was using xampp for apache, php and mysql, so the mysql socket was inside xampp folder and I could solve it thanks to ccm (see the post if you feel curious).

But past week I decided I was fed up with xampp and not knowing where are the things, and more specially, not having a working version of Apache with mod_rewrite, so I went for the hard way and compiled and installed all from scratch (apache, php, mysql). Then what happened is that mysql socket is now in /tmp/mysql.sock but for some reason cake (and obviously php) is looking for the socket in /var/mysql/mysql.sock. Why, I don't know - since the application I'm developing works perfectly (I presume that's because it's running in a virtual host and thus php doesn't try to connect with localhost but with http, as it believes that it's not localhost actually).

In any case, it's just bake which fails.

Well, it was just bake which failed, since I decided to solve it all quickly. Did it want a socket in /var/mysql/mysql.sock?

There you go! Open a terminal and…

cd /var
sudo mkdir mysql (if a mysql directory doesn't exist there)
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

bye bye error! now enjoy bake!

This trick is maybe dirty but I'm fed up of running ./configure and friends. If you know why it failed before, you can leave a comment… and I'll appreciate it much :)

// 3 responses to Wrong location of mysql.sock?

Jcl
Jcl
20060807

Cambia en /etc/php.ini, en la seccion [MySQL]:

mysql.default_socket = /var/mysql/mysql.sock

por

mysql.default_socket = /mysql/mysql.sock

Es definitivamente más limpio, más seguro, y no hace falta ni recompilar :-)

(Por cierto, busca en /var porque la instalacion por defecto de MacOS X 10.4 cambió la ruta por defecto a /var/mysql , en vez de /mysql).

No olvides hacer un chmod 775 a /mysql

En cierta instalación que tuve que hacer a distancia en un OSX 10.4 me volví loco (aunque a la inversa, cambiar de /mysql a /var/mysql ) con esto… había un articulo KB de Apple para ello en algun sitio.

PD: por qué he escrito en castellano? Que me aspen si lo sé :-)

Smooches

HeV
HeV
20060809

Buenas Sole, ¿cómo llevas el verano? :P

Me he puesto como deberes en mi aprendizaje de inglés leerme tus posts en ese idioma. Por cierto, me acabo de iniciar en el mundo Mac ^^ y tiene muy buen pinta.

Jaime
Jaime
20070205

Gracias, tenia este problema y con tu truco lo resolvi altirante :) no se me habia ocurrido, gracias.

Thanks, i've got this issue and with your trick I solved it , thanxs ;)

You came late to the party

Comments are closed, but if you want to comment anything about this entry please let me know using the info in this page.