Re: MySQL server socket problem
Steve Holdoway <[email protected]> Wed, 14 Dec 2011 17:29:12 +1300
| Newsgroups | gmane.org.user-groups.linux.new-zealand.general |
|---|---|
| Organization | Green Gecko Global Ltd. |
| Message-ID | <1323836952.16572.692.camel@steve-desktop> |
--===============1957566093==
Content-Type: multipart/signed; micalg="sha1";
protocol="application/x-pkcs7-signature";
boundary="=-ol36Bv6CxgtMmoJDFxXn"
--=-ol36Bv6CxgtMmoJDFxXn
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Wed, 2011-12-14 at 15:03 +1100, John Reid wrote:
> Having briefly run MySQL successfully from a C program, the next time I
> booted up mysqld failed
>=20
> Relevant syslog info was:
>=20
> error: 'Can't connect to local MySQL server through socket
> '/var/run/mysqld/mysqld.sock' (2)'
> Check that mysqld is running and that the socket:
> '/var/run/mysqld/mysqld.sock' exists!
>=20
> (mysqld.sock does not exist)
>=20
> Checked this out on the Web and found
>=20
> This bug can be fixed by:
> 1) Adding a line that says
> include "/etc/bind/rndc.key";
> to /etc/bind/named.conf
> and then
> 2) Making /etc/bind/rndc.key be owner root:bind mode 640
> chown root:bind /etc/bind/rndc.key
>=20
> I did this but it did not fix the problem.
>=20
> Any ideas?
Not sure where you got that answer from, but reconfiguring DNS isn't
going to help!
You have 2 means of addressing this: changing the server, or changing
the client. Usually the former is easier.
Both of these require that you modify my.cnf, and (optionally) restart
the server. Thi file either resides in /etc or /etc/mysql for the major
distros.
To change the server to use /var/run/mysqld/mysqld.sock, add the line
socket =3D /var/run/mysqld/mysqld.sock
to the block starting
[mysqld]
and restart with /etc/init.d/mysql restart=20
(this might be /etc/init.d/mysqld)
To change the client to use the current socket, first find out what it
is:
ps -fumysql | grep -v PID | awk '{print $2}' | xargs lsof -p | grep unix
is an one liner that print it out...
You then add=20
that entry as before in the [client] block using the same format as
before. Unfortunately there are a few languages ( perl IIRC ) that don't
honour this, so I recommend changing the server setup.
hth,
Steve
--=20
Steve Holdoway BSc(Hons) MNZCS <[email protected]>
http://www.greengecko.co.nz
MSN: [email protected]
Skype: sholdowa
--=-ol36Bv6CxgtMmoJDFxXn--
--===============1957566093==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
NZLUG mailing list [email protected]
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
--===============1957566093==--