1

I installed Ubuntu headless server 14.04 yesterday. The only thing, at that point, that I installed was ssh. I updated the server then installed Plesk with their automated install script.

This is a virtual server running on hyper-v. I have 12 cores, 16gb ram, and a 500gb hd alloted it.

I accessed the website without issue. I do not have a valid ssl certificate yet as I hadn't gotten that far. I then installed the license for Plesk. I did a little snooping around to see how it works and then went to bed. I started this morning on it and the site wouldn't come up. I kept getting connection refused when I tried to access the site. I read around and it said to try this to fix it:

cd /var 
sudo mkdir mysql
sudo chmod 755 mysql
cd mysql
sudo ln -s /tmp/mysql.sock mysql.sock

This allowed me to access the site. When I try to do anything in the site, I get this:

ERROR: PleskDBException: Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible. (Abstract.php:69)

I checked the logs in /var/log/mysql/error.log, the mysql.error was zero bytes:

151126 10:59:24 mysqld_safe Number of processes running now: 0
151126 10:59:24 mysqld_safe mysqld restarted
151126 10:59:24 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
151126 10:59:24 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.14.04.2) starting as process 3082 ...
151126 10:59:24 [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.
151126 10:59:24 [Note] Plugin 'FEDERATED' is disabled.
151126 10:59:24 InnoDB: The InnoDB memory heap is disabled
151126 10:59:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151126 10:59:24 InnoDB: Compressed tables use zlib 1.2.8
151126 10:59:24 InnoDB: Using Linux native AIO
151126 10:59:24 InnoDB: Initializing buffer pool, size = 128.0M
151126 10:59:24 InnoDB: Completed initialization of buffer pool
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
151126 10:59:24  InnoDB: Retrying to lock the first data file
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11

I have not made any changes other than what I stated above. Anyone have any suggestions where to look or what to do?

Additional Info:

[24-Nov-2015 20:23:38 America/Chicago] PHP Warning: chgrp(): Operation not permitted; File: /opt/psa/admin/plib/Plesk/Log.php, Line: 66

[2015-11-24 20:23:38] ERR [1] PHP Warning: chgrp(): Operation not permitted; File: /opt/psa/admin/plib/Plesk/Log.php, Line: 66

[2015-11-24 20:24:19] ERR [1] Module configs is not installed.
[2015-11-24 21:18:21] ERR [panel] [Action Log] Failed login attempt with login 'techguyalabama' from IP 50.2.213.12
[2015-11-24 21:18:28] ERR [panel] [Action Log] Failed login attempt with login 'admin' from IP 50.2.213.12
[2015-11-25 09:30:45] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/spammng' '--status'] with exit code [1]
[2015-11-25 09:30:45] ERR [1] '/opt/psa/admin/bin/spammng' '--status' failed with code 1.

stdout:


stderr:
ERROR:spammng:[Errno 2] No such file or directory: '/etc/default/spamassassin'

[2015-11-25 12:49:51] ERR [panel] [Action Log] Failed login attempt with login '<invalid>' from IP 104.238.110.138
[2015-11-26 06:25:03] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:27:18] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 10:27:18] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:51:37] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 10:51:37] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:59:31] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:59:32] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:59:32] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 10:59:32] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:08:57] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/api-common/AbstractCu.php:1640
        AbstractCu::initDb()
2: /opt/psa/admin/plib/api-common/AbstractCu.php:1666
        AbstractCu::initCLI()
3: /opt/psa/admin/plib/scripts/setup-health-monitor.php:5
[2015-11-26 11:08:57] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:09:08] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:13:47] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:13:47] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:22:41] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:22:41] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:22:41] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:23:32] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 11:23:32] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:23:52] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 11:23:52] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:23:56] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 11:23:56] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2015-11-26 11:24:00] ERR [panel] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
        CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
        Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/auth.php:325
        AutoPrepend->initUserSession()
3: /opt/psa/admin/plib/auth.php:230
        AutoPrepend->run()
4: /opt/psa/admin/plib/auth.php:759
[2015-11-26 11:24:00] ERR [1] Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.

A little more info:

Searched for the mysqld.sock and mysql.sock:

> sudo find . -name mysqld.sock
> sudo find . -name mysql.sock
./var/mysql/mysql.sock
> sudo find . -name my.cnf
./etc/mysql/my.cnf

Checked out my.cnf and it had this:

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

This directory is empty: /var/run/mysqld

I'm not that familiar with the MySql setup but I figured I'd share this...

  • I think you might have to edit your /etc/mysql/my.cnf. Because MySQL miss located your MySQL pid-file and socket path location. For reference, see this – adadion Nov 27 '15 at 4:52
2

I experienced this today. I just stopped mysql and started it again:

# service mysql stop
mysql stop/waiting
# service mysql start
mysql start/running, process 4042

I am unsure about a proper fix for this.

Edit:

After tailing /var/log/mysql/error.log I determined that there were multiple versions of mysql attempting to run. I removed /etc/init.d/mysql and did not receive this error on next reboot.

Edit 2:

BACKUP /etc/init.d/mysql FIRST

# This will maintian all file ownership and permissions
# and back this up in your home directory:
cp -ar /etc/init.d/mysql "$HOME" 

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.