Wednesday, May 25, 2011

MySQL Error 2002

I was reading an article about MySQL replication yesterday. After reading a bit I thought it will be really easy to test it. I setup a remote MySQL server available with a friend and configured it as master. After this I fired up Ubuntu Lucid Lynx VM in VirtualBox and configured it as slave (changed my.cnf file mainly).

Now when I tried to login into MySQL I got following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
After sifting through many posts on internet forums, I occured to me to check error logs (how intelligent, thought this should have been first thing to do). I issued following command:

tail /var/log/mysql/error.log

110525 23:19:20 [ERROR] /usr/sbin/mysqld: unknown variable 'relay-logn-index=test_slave-bin.index'
110525 23:19:20 [ERROR] Aborting

So it was only an extra 'n' that gave me so much headache. After changing 'relay-logn-index' to 'relay-log-index' it worked fine.