About mysql connection

Hello Everyone,

I am getting the error as

"ERROR:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"

Can anyone help me if you have experienced the same issue ?

Thanks in advance.

Vijay

5 Replies

Is mysql running?

Try````
service mysql start

What's the output of````
ps aux | grep mysql

say?

What distribution are you running?

What do the logs in /var/log/mysql say?

First command gives

mysql: unrecognized service

second command gives

root 14781 0.0 0.1 61260 668 pts/0 D+ 01:25 0:00 grep mysql

You have new mail in /var/spool/mail/root

I am using centos 5.6.

And the log says after restarting mysqld

Number of processes running now: 0

120618 01:55:09 mysqld restarted

InnoDB: The log sequence number in ibdata files does not match

InnoDB: the log sequence number in the ib_logfiles!

120618 1:55:10 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…

120618 1:55:10 InnoDB: Started; log sequence number 0 381122399

120618 01:55:11 mysqld ended

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…

120618 1:52:16 InnoDB: Started; log sequence number 0 381122399

120618 1:52:16 [Note] /usr/libexec/mysqld: ready for connections.

Version: '5.0.95' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution

Thanks.

Vijay

Looks like mysql crashed for some reason, the correct start command on centos is service mysqld start give that a go and check the mysql logs again.

Hi ,

After running the commnad as you mentioned mysql started.

And the log is:

Number of processes running now: 0

120619 05:45:57 mysqld restarted

InnoDB: The log sequence number in ibdata files does not match

InnoDB: the log sequence number in the ib_logfiles!

120619 5:45:58 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…

120619 5:45:58 InnoDB: Started; log sequence number 0 381122399

120619 05:45:59 mysqld ended

But still in my connection files it gives

"ERROR:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)".

Looks like your innodb settings have got corrupted some how, you have to real options. 1 restore from the latest backup you have or 2 try and recover the innodb tables see here http://dev.mysql.com/doc/refman/5.0/en/ … overy.html">http://dev.mysql.com/doc/refman/5.0/en/forcing-innodb-recovery.html

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct