Cannot start MySQL: Another MySQL daemon already running with the same unix socket.

Today I had a little drama. I noticed that one of my servers was not working at all since the MySQL server was down. Initially I thought that maybe it was a problem of lack of free space in the hard drive. But it wasn’t. I am running CentOS in a 1and1 virtualserver.

This is the problem:

$ service mysqld restart
Stopping mysqld: [ OK ]
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]

So I started searching and found the solution:

$ mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
$ service mysqld start
Starting mysqld: [OK]

This sorted it out nicely 🙂

Thanks to GeckoSEO for his solution in StackOverflow http://stackoverflow.com/questions/20407292/centos-another-mysql-daemon-already-running-with-the-same-unix-socket

mysql does not start and parallels is not working

I just experienced a major server breakdown in 1and1. MySQL crashed and when I tried to restart it the result would be negative:

 

Then I restarted the server and the problem persisted.

So my third action was to have a look at my Parallels Plesk web panel, and the result was that it would not load, showing a MySQL problem.

I then figured out that the problem could be a lack of memory, so I entered with ssh to the server and started listing directory sizes, using the great “du” linux command:

du -h –max-depth=1

until i found that the problem was in the backups folder:

/var/lib/psa/dumps

then I deleted one of the backup folders and could restart mysql

service mysqld restart

Thanks to this guide for the du parameters: http://www.linfo.org/du.html

 

 

MAMP: how to use MYSQL from console

I could not access the mysql database from console, getting this error

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ 

So I googled and found this:

http://fischerlaender.de/apple-mac/mac-os-x-trouble-with-mamp-mysql

and I sorted it out using:

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

This will allow you to access through the console and do things such as

mysql -u root …

But now, there is an additional challenge. When I try to use the database through php (launching the console php -a), using sentences to connect such as mysql_connect(DB_HOST, DB_USUARIO, DB_PASSWORD) it will return the error

Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in php shell code on line 1

So, again searching in google, this is the solution: http://stackoverflow.com/questions/4219970/warning-mysql-connect-2002-no-such-file-or-directory-trying-to-connect-vi

sudo mkdir mysql

cd mysql/

sudo ln -s /tmp/mysql.sock mysql.sock

 

 

mysql keeps crashing, how to solve it?

I am using a very simple digitalocean basic server with 512mb RAM, and using Ubuntu 12.04 64bits

I tried the recommendations here:

https://www.digitalocean.com/community/questions/mysql-on-ubuntu-keeps-crashing

But still keeps crashing, so I have looked for further information, and this one seems to be a good guide to tweak the server, both apache and mysql:

https://library.linode.com/troubleshooting/memory-networking#sph_apache-2-low-memory-settings

I think that the key point for me is that I chose Ubuntu 64 bits without being aware that 64 bits Ubuntu takes around 50% more memory than 32 bits

So now I guess the solution is to downgrade to a 32bit server, which will be a bit of a pain… but if this solves the performance issue, then I will surely do it.

 

 

more performance for your WordPress install

i look forward to installing my next WP blog under nginx

This guide looks a good start:

https://www.digitalocean.com/community/articles/how-to-install-wordpress-nginx-php-and-varnish-on-ubuntu-12-04

and this for a Varnish improvement

https://www.digitalocean.com/community/articles/how-to-install-wordpress-nginx-php-and-varnish-on-ubuntu-12-04

and if you have a Mac, then you can install locally this set

MNPP: http://getmnpp.org/