Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jun 2009 15:25:26 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        thanos trompoukis <atr0x23@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: mysql error
Message-ID:  <4A477D56.7090408@infracaninophile.co.uk>
In-Reply-To: <d4a469990906280612lbed863fx45263c3463094ceb@mail.gmail.com>
References:  <d4a469990906280612lbed863fx45263c3463094ceb@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigF3B5CF0058DC303B36725476
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

thanos trompoukis wrote:
> Hi all, I am new with FreeBSD and I have a problem with mysql.
>=20
> I have 6.2Release i386
> I am running mysql 5.0.27 and It worked perfectly until the time that I=

> formated  /tmp (for some other reason)
> and now when I am trying to connect on mysql *I get this:*
>=20
> *[root@leonidas:/]$ mysql
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
> '/tmp/mysql.sock2' (38)*
>=20
> *and when I edit /var/db/mysql/leonidas.MSHOME.err  I see this:*
>=20
> *090628 14:49:19  mysqld started
> 090628 14:49:19 [Warning] Ignoring user change to 'ser=3Dmysql' because=
 the
> user was set to 'mysql' e
>=20
> 090628 14:49:20  InnoDB: Started; log sequence number 0 43655
> 090628 14:49:20 [ERROR] Can't start server : Bind on unix socket: Permi=
ssion
> denied
> 090628 14:49:20 [ERROR] Do you already have another mysqld server runni=
ng on
> socket: /tmp/mysql.soc
> 090628 14:49:20 [ERROR] Aborting
>=20
> 090628 14:49:20  InnoDB: Starting shutdown...
> 090628 14:49:22  InnoDB: Shutdown completed; log sequence number 0 4365=
5
> 090628 14:49:22 [Note] /usr/local/libexec/mysqld: Shutdown complete
>=20
> 090628 14:49:22  mysqld ended
>=20
> *I have checked /tmp and there is no mysql.sock file. (because I format=
ed
> /tmp immagine)
> I wouldn't like to loose my database, and I have no idea....
> What I have to do?
>=20
> Thanx!  :D

You've apparently got a copy of mysql still running, despite trashing eve=
rything
in /tmp.  You can confirm that by:

   % sockstat | grep mysql

Now, if sockstat shows that mysql is listening on a network interface,
then you may just be able to log into it over a network connection and
shut it down cleanly.  If not, then you have no alternative by to signal
the process to death and then let it repair the datafiles as it restarts.=


  * If you have to kill mysql by signalling it:

    At first, try:

    # kill -15 `ps -ax | grep mysqld | cut -d ' ' -f 2`

    If it doesn't work immediately, leave mysql for 5 minutes, and see if=
 it
    has shut down yet.  Try again if not, possibly several times.  Failin=
g that,
    use:

    # kill -9 `ps -ax | grep mysqld | cut -d ' ' -f 2`

    But this last really should be avoided, as it causes the process to c=
rash
    without any opportunity to close itself down nicely.

  * If mysql is listening on a network interface -- preferably any of=20
    127.0.0.1:3306, [::1]:3306 or *:3306=20

    Try using mysqladmin to shut it down cleanly. Note that mysql does
    special shortcut things when hostname is localhost and tries to use t=
he
    socket in /tmp/mysql.sock -- which doesn't help you at all.  You can =
force
    it to make a *network* connection to localhost by:

    # mysqladmin -h localhost -P 3306 --protocol=3DTCP -u root -p shutdow=
n

    This will prompt you for the mysql root password. If mysqladmin doesn=
't work,
    then try using kill as above.

Your data *should* survive MySQL being forcibly restarted in either of th=
ese ways.  MySQL takes very great pains to ensure data is written to pers=
istent media (ie.
disk) in order to provide proper ACID compliance.  However, if mysql does=
 get killed, it will need to do some repair work on data structures when =
it next starts up, and
that can take a while.  Because writing out its PID file is one of the la=
st things
mysql does in the startup sequence '/usr/local/etc/rc.d/mysql-server stat=
us' will
report 'not running' during this repair work, so be a bit patient if you =
see that.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW


--------------enigF3B5CF0058DC303B36725476
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAkpHfWEACgkQ8Mjk52CukIzw4ACfY0oJ4nhOmYb6yDP/LZtPy1qQ
JDkAoJWT0zxJWXJ0AZqykADLkbK861MT
=Fj56
-----END PGP SIGNATURE-----

--------------enigF3B5CF0058DC303B36725476--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A477D56.7090408>