Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqld failing to start, and mysql error 2002

Tags:

mysql

lamp

debian

Okay, I've looked around, but I'm very confused with the problem. Please forgive me if it's something stupid. :*S I'm running 32bit Debian 6.0.6.

    root@debian:~# service mysql start
    Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

So, the the service fails to start.

    root@debian:~# mysql
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

And this is the error given when running the command mysql. Is this error because mysqld failed to start? Or is there another reason?

I went to the directory, /var/mysqld/ and there wasn't a file named mysqld.sock. Is that the issue, or am I an idiot? hahah. Any help would be greatly appreciated. Thank you for your time.

EDIT: Also, it appears that logs associated with mysql, such as mysql.log and mysql.err have no value to them, they're blank. Also, I've chmod 777'd all the directories that mysql acts in. The service still continues to refuse running.

like image 813
DrDeviation Avatar asked Jan 06 '13 03:01

DrDeviation


People also ask

Can't connect to local MySQL server socket error 2002?

The ERROR 2002 above happens when the mysql. sock socket file can't be found in your filesystem. This file is created when MySQL server is started and removed when you stop the server. To fix this error, you need to see if MySQL server is already installed and running on your computer.

How fix MySQL is not starting?

Fixing the MySQL server not starting in XAMPP is done by reverting back the data files pre-issue. Navigate to your XAMPP MySQL directory ( C:\xampp\mysql ). Create a new folder called FIX_BACKUP . Copy C:\xampp\mysql\backup and C:\xampp\mysql\data into C:\xampp\mysql\FIX_BACKUP .


2 Answers

Try to track down the error a bit differently. Run MySQL in the foreground.

mysqld_safe --log-error=/var/log/mysql.err

This should produce a log with some details at /var/log/mysql.err hopefully and add the details to your question if any in case my solution below doesn't work and someone else can help.

You may end up getting an error mysqld_safe: command not found and if you do, use the locate command to find it.

locate mysqld_safe

This will tell you where it is. For example, if it returns /usr/bin/mysqld_safe, run the command

/usr/bin/mysqld_safe --log-error=/var/log/mysql.err

If I had to hazard a guess, you will find an error about pthreads.

InnoDB: Error: pthread_create returned 12

If this is the case, the easy solution is to disable InnoDB for MySQL. Chances are you won't need this, so disable it in the config.

To turn off InnoDB, edit the MySQL configuration file at /etc/mysql/my.cnf and add this to it

skip-innodb

Now start MySQL

/etc/init.d/mysql start
like image 105
Kirk Avatar answered Nov 01 '22 11:11

Kirk


I had the same problem.

The /tmp dir was not writbale, so MYSQL couldn't write some needed file.

Just do this :

chmod 777 /tmp

and restart mysql

/etc/init.d/mysql start
like image 37
gael Avatar answered Nov 01 '22 10:11

gael