user2255224
user2255224

Reputation: 89

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) . mysql.sock not exist in /var/lib/mysql/

Magento Showing "There Has Been Error Processing Your Request "

When trying to command " sudo service mysqld restart" but failed to Start

Then See the Log Showing me " SQLSTATE[HY000] [2002] No such file or directory "

I do Little search on Google, stackoverflow, magento stackoverflow sites and at last got something may be

after the Command " mysqld -u root -p status"

showing 'mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

I located that I don't have mysql.sock in /var/lib/mysql/ So now what I should do . I am not in expert just newbie . Unfortunately I gave 777 permission to all directory in ec2 instance, after some time of this Issue I see My site " There has been an error processing your request . for ec2 security reason I was not able to access instance using ftp or ssh . so I had to do create new instance gave this EBS to new instance , after changing permission I able to access my instance

Please take a look at my my.cnf file. I am seeing something can help

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Here is The mysqld.log

/usr/libexec/mysql55/mysqld: Can't create/write to file '/tmp/ibmCz4dv'     (Errcode: 13)
160212 18:29:37  InnoDB: Error: unable to create temporary file; errno: 13
160212 18:29:37 [ERROR] Plugin 'InnoDB' init function returned error.
160212 18:29:37 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE   failed.
160212 18:29:37 [ERROR] Unknown/unsupported storage engine: InnoDB
160212 18:29:37 [ERROR] Aborting
160212 18:29:37 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete
160212 18:29:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

775 to /tmp and Now The mysqld.log

775 to /tmp and mysqld.log

/usr/libexec/mysql55/mysqld: Can't create/write to file '/tmp/ibLzshr1' (Errcode: 13)
160213  9:08:59  InnoDB: Error: unable to create temporary file; errno: 13
160213  9:08:59 [ERROR] Plugin 'InnoDB' init function returned error.
160213  9:08:59 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160213  9:08:59 [ERROR] Unknown/unsupported storage engine: InnoDB
160213  9:08:59 [ERROR] Aborting

160213  9:08:59 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete

160213 09:08:59 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Please help me to Sort it out

Upvotes: 0

Views: 1966

Answers (2)

user2255224
user2255224

Reputation: 89

I want to say thanks @ Axel Amthor . Finally I gave /tmp file 777 and Restarted mysqld .. and Boom

Site back in Action . Sorry i can't give Upvote because i didn't have reputation 15 :(

Upvotes: 0

Axel Amthor
Axel Amthor

Reputation: 11096

The mysql user obviously doesn't have the rights to create a file in /tmp according to

/usr/libexec/mysql55/mysqld: Can't create/write to file '/tmp/ibmCz4dv'     (Errcode: 13)

check the access rights on /tmp, should be 777. BTW sys "errno 13" is "Permission denied"

According to this, the server stops and doesn't create any socket which then causes the connect error.

Upvotes: 0

Related Questions