Error: MySQL Innodb “Failed to locate MySQL socket. Please check the mysql configuration.”

Posted on Updated on

I recently came across a Cpanel server which mysqld refused to start, Getting error “Failed to locate MySQL socket. Please check the mysql configuration“. In mysql error log  default /var/lib/mysql/HOSTNAME.err it was no surprise to find that the mysql user table had been marked as crashed.

[root@server mysql]# tail -f /var/lib/mysql/HOSTNAME.err
110108 10:37:45  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 1 3749263016.
InnoDB: Doing recovery: scanned up to log sequence number 1 3749263050
InnoDB: Last MySQL binlog file position 0 79, file name ./host89-bin.000005
110108 10:37:45  InnoDB: Flushing modified pages from the buffer pool...
110108 10:37:45  InnoDB: Started; log sequence number 1 1234563550
InnoDB: !!! innodb_force_recovery is set to 1 !!!
110108 10:37:45 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'user' is marked as crashed and should be repaired
110108 10:37:45  mysqld ended

Now set mysql recovery option as 1 and start MySQL without privilege safe mode

[mysqld]
innodb_force_recovery = 1

 

[root@server ~]#/usr/sbin/mysqld --skip-grant-tables --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock

Now I can login to the database, its time to repare user tables by following below steps,

[root@server ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 183 to server version: 4.1.22-standard-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
mysql> check table user;
+------------+-------+----------+----------------------------------------------------------+
| Table      | Op    | Msg_type | Msg_text                                                 |
+------------+-------+----------+----------------------------------------------------------+
| mysql.user | check | warning  | Table is marked as crashed                               |
| mysql.user | check | warning  | 6 clients are using or haven't closed the table properly |
| mysql.user | check | error    | Record at pos: 28492 is not remove-marked                |
| mysql.user | check | error    | record delete-link-chain corrupted                       |
| mysql.user | check | error    | Corrupt                                                  |
+------------+-------+----------+----------------------------------------------------------+
5 rows in set (0.02 sec)

mysql> repair table user;
+------------+--------+----------+------------------------------------------+
| Table      | Op     | Msg_type | Msg_text                                 |
+------------+--------+----------+------------------------------------------+
| mysql.user | repair | warning  | Number of rows changed from 1384 to 1385 |
| mysql.user | repair | status   | OK                                       |
+------------+--------+----------+------------------------------------------+
2 rows in set (0.48 sec)

mysql> check table user;
+------------+-------+----------+----------+
| Table      | Op    | Msg_type | Msg_text |
+------------+-------+----------+----------+
| mysql.user | check | status   | OK       |
+------------+-------+----------+----------+
1 row in set (0.01 sec)

mysql>exit

Now remove the innodb recovery option and start MySQL as normal mode.

[root@server mysql]# service mysql restart
Advertisements

5 thoughts on “Error: MySQL Innodb “Failed to locate MySQL socket. Please check the mysql configuration.”

    Leroy said:
    April 22, 2013 at 1:41 pm

    Hello i am kavin, its my first occasion to commenting
    anyplace, when i read this post i thought i could also make comment due to this
    good post.

    Demetra said:
    May 7, 2013 at 4:03 pm

    I’m now not sure where you’re getting your information, however good topic.
    I must spend some time finding out more or working out more.
    Thank you for fantastic information I used to be in search of this information for my mission.

    Anand babu responded:
    May 8, 2013 at 6:50 pm

    These are the issues that I faced in my way, thanks for your comment Demetra.

    I seldom comment, but after looking at some of the comments on Error: MySQL Innodb Failed to
    locate MySQL socket. Please check the mysql configuration.
    | Tech’s you need !!!!!. I do have a couple of questions for you if you don’t mind.

    Is it only me or does it look as if like some of the
    comments appear like they are left by brain dead people?
    😛 And, if you are writing at other online
    social sites, I would like to follow anything new you have to post.
    Would you list of every one of all your social sites like your Facebook page, twitter feed, or linkedin
    profile?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s