Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have run into this error with a MySQL database installed on lucid lynx 10.04 that was working fine. The last activity carried out before this problem manifested was exporting a database back up using phpmyadmin. Now any attempt to connect results in this error whether from the command line, phpmyadmin tool or php script.

Most of the answers to similar posted questions involve finding where the mysqld.sock file is created and modifying the my.cnf file to point to its locaion. However I cannot see where the mysqld.sock file is created.

I have verified that mysql is running as a service and following one forum advice, typing ps -fea | grep mysqld results in the following:

rich      10796 8900 0 08:13 pts/1 00:00:00 grep --color=auto mysqld

mysqld is shown in red. The rest of the advice given is to use the above output line to locate the file and modify the my.cnf file accordingly. However I do not know how to interpret the above information to this effect - being a noobie to ubuntu I am in the unhappy position of usually not understanding what the purpose of command lines (often suggested without an explanation) is and what their results should be so am reduced to randomly typing them in from various similar forum questions in the hope that eventually one will have the desired effect without breaking the whole thing in the process.

Could anyone advise a step by step trouble-shooting guide to this problem? Where should the file be ceated in Ubuntu? The path in the /etc/mysql/my.cnf file is /var/run/mysqld/myslqd.sock. I presume this must have been where the file was being created previously when it was working unless the my.cnf file has been changed by some sort of automatic update, which I wouldn't have thought so given a password is usually required in ubuntu before such changes are made.

Thanks Richard

share|improve this question

migrated from stackoverflow.com Jun 21 '12 at 10:02

This question came from our site for professional and enthusiast programmers.

    
Judging from the output of ps -fea | grep mysqld, you do not have MySQL running. –  lanzz Jun 20 '12 at 7:39

1 Answer 1

Try out the below steps .,

backup the my.cnf.,

change the socket location to different location .,.

restart the mysql with #/etc/init.d/mysql restart

try to connect with new socket .

share|improve this answer
    
as far as I know, linux doesn't allow you to start mysql as that. It wants the service mysqld [re]start command. –  T-Shirt Dude Jun 20 '12 at 7:53
    
Thanks to all who have responded so far. –  nortyrich Jun 20 '12 at 20:14
    
Thanks to all who have responded so far. Lanzz: If I run service --status-list, mysql is shown with the symbol [?]. This corresponds to 'unknown'. I suppose I should be expecting [+]. If I run sudo initctl list, mysql is shown in the list of results with 'start/running'. However there is no process number. Again I am not sure what I should be expecting. tsabz: Sorry, not sure what you mean. sandeep: Tried this but didn't work. The command for restart seemed to go off alright after a password prompt but there was no feedback. T-Shirt Dude: this command line fails as unrecognised service. –  nortyrich Jun 20 '12 at 20:28
    
Just to add have tried a command from ubuntu to check mysql status sudo netstat -tap | grep mysql This returns nothing, just goes to the next command prompt. When using the sudo /etc/init.d/mysql restart command a message contained in the my.cnf file is shown which starts "Rather than invoking init scripts..." and ends "start: Job is already running: mysql" The command 'service mysql restart' results in command unrecognised and the command 'sudo service mysql restart' hangs. Still none the wiser. –  nortyrich Jun 20 '12 at 21:16
    
....after a complete reboot due to the command 'sudo service mysql restart' hanging, normal service has resumed and everything is running again. Had tried rebooting several times before to no effect so it seems the last command I tried shifted something. Guess its just one of those things - two evenings of my life I will never get back and probably will never know why. Computers suck. –  nortyrich Jun 20 '12 at 21:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.