1

I use Ubuntu Server 12.04 for my Django project. On my local PC there is no errors and etc. Sometimes on server I have error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

Logs:

cat /var/log/mysql/error.log
140415 23:05:34 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140415 23:05:34 [Note] Plugin 'FEDERATED' is disabled.
140415 23:05:34 InnoDB: The InnoDB memory heap is disabled
140415 23:05:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140415 23:05:34 InnoDB: Compressed tables use zlib 1.2.3.4
140415 23:05:34 InnoDB: Initializing buffer pool, size = 128.0M
140415 23:05:34 InnoDB: Completed initialization of buffer pool
140415 23:05:34 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
140415 23:05:34  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
140415 23:05:35 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140415 23:05:35 [Note] Plugin 'FEDERATED' is disabled.
140415 23:05:35 InnoDB: The InnoDB memory heap is disabled
140415 23:05:35 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140415 23:05:35 InnoDB: Compressed tables use zlib 1.2.3.4
140415 23:05:35 InnoDB: Initializing buffer pool, size = 128.0M
140415 23:05:35 InnoDB: Completed initialization of buffer pool
140415 23:05:35 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
140415 23:05:35  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...

I see that error (2002) very often, I cant understand - why it appears.

I try /etc/init.d/mysql restart or service mysql restart, but it doesnt help. I have mysql-server, not a client. So it works, works, works and in one beatifull moment I see that error.

ps ax | grep mysql
15654 pts/0    S+     0:00 grep --color=auto mysql

So, I try

sudo service mysql start
start: Job failed to start

Logs:

140416  1:11:17 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140416  1:11:17 [Note] Plugin 'FEDERATED' is disabled.
140416  1:11:17 InnoDB: The InnoDB memory heap is disabled
140416  1:11:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140416  1:11:17 InnoDB: Compressed tables use zlib 1.2.3.4
140416  1:11:17 InnoDB: Initializing buffer pool, size = 128.0M

dpkg -l | grep mysql
ii  libdbd-mysql-perl                    4.020-1build2                     Perl5 database interface to the MySQL database
ii  libmysqlclient18                     5.5.35-0ubuntu0.12.04.2           MySQL database client library
ii  mysql-client-5.5                     5.5.35-0ubuntu0.12.04.2           MySQL database client binaries
ii  mysql-client-core-5.5                5.5.35-0ubuntu0.12.04.2           MySQL database core client binaries
ii  mysql-common                         5.5.35-0ubuntu0.12.04.2           MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                         5.5.35-0ubuntu0.12.04.2           MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.5                     5.5.35-0ubuntu0.12.04.2           MySQL database server binaries and system database setup
ii  mysql-server-core-5.5                5.5.35-0ubuntu0.12.04.2           MySQL database server binaries
ii  python-mysqldb                       1.2.3-1ubuntu0.1                  Python interface to MySQL

How to fix that? How to restart? Why I see that error? Whats wrong?

Thaks.

UPDATE

grep socket /etc/mysql/my.cnf                       
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
socket      = /var/run/mysqld/mysqld.sock
#socket=/var/lib/mysql/mysql.sock
socket      = /var/run/mysqld/mysqld.sock
socket      = /var/run/mysqld/mysqld.sock

And

/var/run/mysqld$ ls -la
total 4
drwxr-xr-x  2 mysql root   80 Apr 13 12:06 .
drwxr-xr-x 16 root  root  520 Apr 16 01:33 ..
-rw-rw----  1 mysql mysql   4 Apr 13 12:06 mysqld.pid
srwxrwxrwx  1 mysql mysql   0 Apr 13 12:06 mysqld.sock
1
  • If I use sudo service mysql stop - stop: Unknown instance:
    – Leon
    Apr 15, 2014 at 21:27

0

You must log in to answer this question.

Browse other questions tagged .