web-dev-qa-db-fra.com

Avoir des problèmes avec MySql

J'ai installé le serveur sans tête Ubuntu 14.04 hier. La seule chose que j'ai installée à ce moment-là était ssh. J'ai mis à jour le serveur, puis installé Plesk avec son script d'installation automatisé.

Ceci est un serveur virtuel fonctionnant sur hyper-v. J'ai 12 cœurs, 16 Go de RAM, et un disque dur de 500 Go attribué.

J'ai accédé au site Web sans problème. Je n'ai pas encore de certificat SSL valide car je ne m'étais pas rendu jusque-là. J'ai ensuite installé la licence pour Plesk. J'ai fouillé un peu pour voir comment cela fonctionnait, puis je suis allé me ​​coucher. J'ai commencé ce matin là-dessus et le site ne serait pas affiché. Je n'arrivais pas à obtenir une connexion lorsque j'essayais d'accéder au site. Je lis autour et il a dit d'essayer ceci pour le réparer :

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

Cela m'a permis d'accéder au site. Lorsque j'essaie de faire quelque chose sur le site, je reçois ceci:

ERREUR: PleskDBException: Impossible de se connecter à la base de données: mysql_connect (): Aucun fichier ou répertoire de ce type /var/run/mysqld/mysqld.sock (Code d'erreur: 2002). Veuillez vérifier que le serveur de base de données est démarré et accessible. (Abstract.php: 69)

J'ai vérifié les journaux dans /var/log/mysql/error.log, le mysql.error avait zéro octet:

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

Je n'ai apporté aucun changement autre que ce que j'ai indiqué ci-dessus. Quelqu'un a des suggestions où chercher ou quoi faire?

Information additionnelle:

[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.

Un peu plus d'infos:

Recherche dans les fichiers mysqld.sock et 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

Vérifié mon.cnf et il avait ceci:

#
# * 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

Ce répertoire est vide:/var/run/mysqld

Je ne connais pas très bien la configuration de MySql, mais j’ai pensé partager cela ...

1
ErocM

J'ai vécu cela aujourd'hui. Je viens d'arrêter mysql et de le redémarrer:

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

Je ne suis pas sûr d'une solution appropriée pour cela.

Modifier:

Après avoir suivi /var/log/mysql/error.log, j'ai déterminé qu'il y avait plusieurs versions de mysql essayant de s'exécuter. J'ai enlevé /etc/init.d/mysql et je n'ai pas reçu cette erreur au prochain redémarrage.

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" 
2
Robert J