mysql error

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Jun 28 14:25:45 UTC 2009


thanos trompoukis wrote:
> Hi all, I am new with FreeBSD and I have a problem with mysql.
> 
> 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:*
> 
> *[root at leonidas:/]$ mysql
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
> '/tmp/mysql.sock2' (38)*
> 
> *and when I edit /var/db/mysql/leonidas.MSHOME.err  I see this:*
> 
> *090628 14:49:19  mysqld started
> 090628 14:49:19 [Warning] Ignoring user change to 'ser=mysql' because the
> user was set to 'mysql' e
> 
> 090628 14:49:20  InnoDB: Started; log sequence number 0 43655
> 090628 14:49:20 [ERROR] Can't start server : Bind on unix socket: Permission
> denied
> 090628 14:49:20 [ERROR] Do you already have another mysqld server running on
> socket: /tmp/mysql.soc
> 090628 14:49:20 [ERROR] Aborting
> 
> 090628 14:49:20  InnoDB: Starting shutdown...
> 090628 14:49:22  InnoDB: Shutdown completed; log sequence number 0 43655
> 090628 14:49:22 [Note] /usr/local/libexec/mysqld: Shutdown complete
> 
> 090628 14:49:22  mysqld ended
> 
> *I have checked /tmp and there is no mysql.sock file. (because I formated
> /tmp immagine)
> I wouldn't like to loose my database, and I have no idea....
> What I have to do?
> 
> Thanx!  :D

You've apparently got a copy of mysql still running, despite trashing everything
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.  Failing 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 crash
    without any opportunity to close itself down nicely.

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

    Try using mysqladmin to shut it down cleanly. Note that mysql does
    special shortcut things when hostname is localhost and tries to use the
    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=TCP -u root -p shutdown

    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 these ways.  MySQL takes very great pains to ensure data is written to persistent 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 last things
mysql does in the startup sequence '/usr/local/etc/rc.d/mysql-server status' will
report 'not running' during this repair work, so be a bit patient if you see that.

	Cheers,

	Matthew

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090628/b96c00e8/signature.pgp


More information about the freebsd-questions mailing list