Posts Tagged ‘freebsd’

How to Re-install Mysql on Freebsd

Monday, November 30th, 2009

freebsd

Say Mysql has completely crashed on your server and while restarting it is showing the below error :-

/usr/local/bin/mysqladmin: connect to server at ‘localhost’ failed error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (61)’ Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists! mysql has failed, please contact the sysadmin (result was “mysql has failed”).

And from the mysql error logs you are getting

/libexec/ld-elf.so.1: /lib/libc.so.7: version FBSD_1.1 required by /usr/local/libexec/mysqld not found

If you have tried all other common fixes then lets now move on to mysql-reinstall.

The steps to reinstall mysql from ports on a freebsd – cpanel servers are as follows.

# cd /usr/ports/databases/

# pkg_info | grep -i mysql

It should display information on mysql packages , something like

bsdpan-DBD-mysql-4.013 DBD::mysql – MySQL driver for the Perl5 Database Interface

mysql-client-5.0.87 Multithreaded SQL database (client)

mysql-server-5.0.87 Multithreaded SQL database (server)

cd /usr/ports/databases/mysql50-server (see which version you have)

make clean

make

make deinstall

make reinstall

/usr/local/etc/rc.d/mysql-server start

/usr/local/etc/rc.d/mysql-server.sh start

Check if mysql is running

# ps wwaux | grep mysql

Make sure that you have given the symlink

# ln -s /var/db/mysql/mysql.sock /tmp

If it still shows down try to re-set the mysql password and restart mysql again .