# MySQL /var/run/mysqld/mysqld.sock | No such file

**URL:** <https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890>\
**Category:** Support Debian\
**Created:** [Octobre 27, 2017, 6:06 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890 "2017-10-27T06:06:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![OverSu](https://www.debian-fr.org/user_avatar/www.debian-fr.org/oversu/32/6092_2.png) [@OverSu](https://www.debian-fr.org/u/OverSu)\
**Post date:** [Octobre 27, 2017, 6:06 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/1 "2017-10-27T06:06:28Z")

</div>

Bonjour tout le monde,

Depuis hier soir, mon nextcloud ne fonctionne plus. En fouillant un peu plus, j’ai vu qu’il y avait un soucis avec MySQL: il était arreté.

Voici ce que me renvoi mon `service mysql status`:

```
- mysql.service - LSB: Start and stop the mysql database server daemon
       Loaded: loaded (/etc/init.d/mysql)
       Active: failed (Result: exit-code) since Thu 2017-10-26 13:51:16 UTC; 1min 50s ago
      Process: 1162 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

    Oct 26 13:50:32 domain.tld systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
    Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
    Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: [61B blob data]
    Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'
    Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
    Oct 26 13:51:16 domain.tld mysql[1162]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
    Oct 26 13:51:16 domain.tld systemd[1]: mysql.service: control process exited, code=exited status=1
    Oct 26 13:51:16 domain.tld systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
    Oct 26 13:51:16 domain.tld systemd[1]: Unit mysql.service entered failed state.

```

Et en effet, le fameux fichier **/var/run/mysqld/mysqld.sock** est inexistant.

En fouillant un peu, je trouve un peu tout et n’importe quoi, mais qui généralement a résolu le problème.

Voici ce que j’ai testé 🙂

**journalctl -u mysql.service** =\> Qui renvoi la même chose  
**systemctl status mysql.service** =\> Idem  
Et **/etc/init.d/mysql start** :

> […] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed. See ‹&nbsp;systemctl status mysql.service&nbsp;› and ‹&nbsp;journalctl -xn&nbsp;› for details.  
> failed!

Quelqu’un à déjà eu ce problème ? 🙂

Sachant que je suis sous Raspbian. (Donc RPI et Debian 8.0)

---

<div class="post-metadata">

**Author:** ![grandtoubab](https://www.debian-fr.org/user_avatar/www.debian-fr.org/grandtoubab/32/4505_2.png) [@grandtoubab](https://www.debian-fr.org/u/grandtoubab)\
**Post date:** [Octobre 27, 2017, 6:13 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/2 "2017-10-27T06:13:28Z")

</div>

Salut  
les commandes d’interrogation du journal et de démarrage du service ne résoudront pas ton problème  
il est identifié: ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)'  
Pourquoi as tu supprimé /var/run/mysqld/mysqld.sock ?

voir ici

> <https://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq/11990813#11990813>

---

<div class="post-metadata">

**Author:** ![OverSu](https://www.debian-fr.org/user_avatar/www.debian-fr.org/oversu/32/6092_2.png) [@OverSu](https://www.debian-fr.org/u/OverSu)\
**Post date:** [Octobre 27, 2017, 6:37 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/3 "2017-10-27T06:37:51Z")

</div>

Je n’ai bien entendu pas supprimé le fichier 😉

Voici ce que me retourne la commande `sudo find / -type s`

```
:~# sudo find / -type s
find: `/proc/2897/task/2897/fd/5': No such file or directory
find: `/proc/2897/task/2897/fdinfo/5': No such file or directory
find: `/proc/2897/fd/5': No such file or directory
find: `/proc/2897/fdinfo/5': No such file or directory
/run/dovecot/quota-warning
/run/dovecot/anvil-auth-penalty
/run/dovecot/anvil
/run/dovecot/auth-worker
/run/dovecot/auth-master
/run/dovecot/auth-userdb
/run/dovecot/auth-client
/run/dovecot/auth-login
/run/dovecot/config
/run/dovecot/dict
/run/dovecot/director-admin
/run/dovecot/dns-client
/run/dovecot/doveadm-server
/run/dovecot/imap-urlauth
/run/dovecot/imap-urlauth-worker
/run/dovecot/indexer
/run/dovecot/indexer-worker
/run/dovecot/ipc
/run/dovecot/log-errors
/run/dovecot/replication-notify
/run/dovecot/replicator
/run/dovecot/ssl-params
/run/dovecot/stats
/run/dovecot/token-login/tokenlogin
/run/dovecot/token-login/imap-urlauth
/run/dovecot/login/login
/run/dovecot/login/imap
/run/dovecot/login/ipc-proxy
/run/dovecot/login/ssl-params
/run/dovecot/login/sieve
/run/php5-fpm.sock
/run/php5-fpm-webapp_streaming.nnsprod.com.sock
/run/php5-fpm-webapp_stats.sock
/run/php5-fpm-webapp_sha1.sock
/run/php5-fpm-webapp_pswd.sock
/run/php5-fpm-webapp_p.sock
/run/php5-fpm-webapp_naheulbeuk.sock
/run/php5-fpm-webapp_md5.sock
/run/php5-fpm-webapp_ip.sock
/run/php5-fpm-webapp_bug.sock
/run/php5-fpm-webapp_blog.nnsprod.com.sock
/run/php5-fpm-webapp_aeos.sock
/run/php5-fpm-wallabag2.sock
/run/php5-fpm-rainloop.sock
/run/php5-fpm-nextcloud.sock
/run/php5-fpm-my_webapp.sock
/run/php5-fpm-dokuwiki.sock
/run/fail2ban/fail2ban.sock
/run/nslcd/socket
/run/slapd/ldapi
/run/dirmngr/socket
/run/thd.socket
/run/dhcpcd.unpriv.sock
/run/dhcpcd.sock
/run/nscd/socket
/run/dbus/system_bus_socket
/run/avahi-daemon/socket
/run/wpa_supplicant/wlan0
/run/postgresql/.s.PGSQL.5432
/run/user/0/systemd/private
/run/user/0/systemd/notify
/run/udev/control
/run/systemd/journal/syslog
/run/systemd/journal/socket
/run/systemd/journal/stdout
/run/systemd/journal/dev-log
/run/systemd/shutdownd
/run/systemd/private
/run/systemd/notify
/var/lib/rspamd/rspamd.sock
/var/spool/postfix/private/dovecot
/var/spool/postfix/private/anvil
/var/spool/postfix/private/proxymap
/var/spool/postfix/private/virtual
/var/spool/postfix/private/scache
/var/spool/postfix/private/trace
/var/spool/postfix/private/proxywrite
/var/spool/postfix/private/bounce
/var/spool/postfix/private/verify
/var/spool/postfix/private/defer
/var/spool/postfix/private/lmtp
/var/spool/postfix/private/local
/var/spool/postfix/private/scalemail-backend
/var/spool/postfix/private/maildrop
/var/spool/postfix/private/bsmtp
/var/spool/postfix/private/mailman
/var/spool/postfix/private/retry
/var/spool/postfix/private/relay
/var/spool/postfix/private/uucp
/var/spool/postfix/private/smtp
/var/spool/postfix/private/ifmail
/var/spool/postfix/private/auth
/var/spool/postfix/private/tlsmgr
/var/spool/postfix/private/discard
/var/spool/postfix/private/rewrite
/var/spool/postfix/private/error
/var/spool/postfix/public/showq
/var/spool/postfix/public/flush
/var/spool/postfix/public/cleanup
/var/spool/postfix/dev/log
/var/spool/postfix/run/rmilter/rmilter.sock

```

Autrement dit, pas de mysqld.

Edit: A priori, pour voir le socket, mysql doit être lancé…?

---

<div class="post-metadata">

**Author:** ![Clochette](https://www.debian-fr.org/user_avatar/www.debian-fr.org/clochette/32/8757_2.png) [@Clochette](https://www.debian-fr.org/u/Clochette)\
**Post date:** [Octobre 27, 2017, 11:45 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/4 "2017-10-27T11:45:25Z")

</div>

> [@grandtoubab](#):
>
> Pourquoi as tu supprimé /var/run/mysqld/mysqld.sock ?

Je doute qu’il ai été supprimé, je pencherai plutôt pour une non création au moment du lancement de mysql

> [@OverSu](#):
>
> Edit: A priori, pour voir le socket, mysql doit être lancé…?

Commence par vérifier quel socket est renseigner dans ton fichier de conf my.cnf, regarde à

```auto
socket = 
```

Ensuite au choix créer le ou tente de renseigner dans le fichier de conf :

```auto
socket = /tmp/mysql.sock
```

Par exemple suivi d’un :

```auto
ln -s /tmp/mysql.sock /var/run/mysqld/mysql.sock
```

---

<div class="post-metadata">

**Author:** ![OverSu](https://www.debian-fr.org/user_avatar/www.debian-fr.org/oversu/32/6092_2.png) [@OverSu](https://www.debian-fr.org/u/OverSu)\
**Post date:** [Octobre 27, 2017, 5:34 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/5 "2017-10-27T17:34:55Z")

</div>

Je viens de créer le fichier, et même erreur. Même en rebootant. 😕

```
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Fri 2017-10-27 17:30:20 UTC; 1min 49s ago
  Process: 1160 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Oct 27 17:30:20 mysql[1160]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Oct 27 17:30:20 systemd[1]: mysql.service: control process exited, code=exited status=1
Oct 27 17:30:20 systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Oct 27 17:30:20 systemd[1]: Unit mysql.service entered failed state.

```

Je me retrouve même avec ceci :

```
root@blog:~# sudo /etc/init.d/mysqld start
sudo: /etc/init.d/mysqld: command not found

```

Un avancement: [https://forum.yunohost.org/t/probleme-de-demarrage-de-la-base-de-donnee-mysql/133](https://forum.yunohost.org/t/probleme-de-demarrage-de-la-base-de-donnee-mysql/133)

J’ai les même erreurs.

---

<div class="post-metadata">

**Author:** ![nico](https://www.debian-fr.org/user_avatar/www.debian-fr.org/nico/32/4003_2.png) [@nico](https://www.debian-fr.org/u/nico)\
**Post date:** [Octobre 28, 2017, 7:51 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/6 "2017-10-28T07:51:31Z")

</div>

J’ai eu pas mal de souci avec cela ces derniers temps sur mariadb sur debian 9 mais je l’avais eu aussi sur lmde (linux mint debian edition).

> [@OverSu](#):
>
> root@blog:~# sudo /etc/init.d/mysqld start  
> sudo: /etc/init.d/mysqld: command not found

la commande est mysql (sans le d).

As-tu essayer de modifier le fichier de conf en ajoutant la ligne :

> innodb\_force\_recovery = 1

> **[MySQL :: MySQL 9.7 Reference Manual :: 17.20.3 Forcing InnoDB Recovery](https://dev.mysql.com/doc/refman/9.7/en/forcing-innodb-recovery.html)**

Puis relancer le serveur mysql, cela peut permettre d’analyser les tables, au minimum de faire une sauvegarde.

---

<div class="post-metadata">

**Author:** ![OverSu](https://www.debian-fr.org/user_avatar/www.debian-fr.org/oversu/32/6092_2.png) [@OverSu](https://www.debian-fr.org/u/OverSu)\
**Post date:** [Octobre 28, 2017, 8:31 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/7 "2017-10-28T08:31:30Z")

</div>

Salut nico,

Merci pour ta réponse, j’ai espoir à chaque nouvelle entrée ! 😃

Malheureusement, cela n’a rien changé pour moi.

Voici mon **my.cnf** situé dans `/etc/mysql/`

```
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
innodb_force_recovery = 1

# to avoid corruption on powerfailure
default-storage-engine=innodb

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking
server-id = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# binary logging format - mixed recommended
#binlog_format=mixed

# Causes updates to non-transactional engines using statement format to be
# written directly to binary log. Before using this option make sure that
# there are no dependencies between transactional and non-transactional
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
# t_innodb; otherwise, slaves may diverge from the master.
#binlog_direct_non_transactional_updates=TRUE

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

```

J’ai reboot le serveur mysql et également le serveur physique, pour voir.

```
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
 failed!

```

As-tu une idée de comment reinitialiser mysql sinon? Sachant que j’ai pas mal d’application dessus (avec backup manuel (/opt…)).

Si y’a une couille dans le potage, autant changer de potage 😃

Merci !

---

<div class="post-metadata">

**Author:** ![nico](https://www.debian-fr.org/user_avatar/www.debian-fr.org/nico/32/4003_2.png) [@nico](https://www.debian-fr.org/u/nico)\
**Post date:** [Octobre 28, 2017, 3:55 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/8 "2017-10-28T15:55:51Z")

</div>

Tu peux toujours essayer avec une valeur plus grande pour innodb\_force\_recovery, genre 4. J’y crois moyen mais ça coûte pas cher d’essayer.

As-tu regarder dans les logs (/var/log/mysql/error.log) ? Si tu vois quelque chose de pertinent, poste-le.

Pour ma part, ma faible expertise s’arrête ici.

---

<div class="post-metadata">

**Author:** ![Clochette](https://www.debian-fr.org/user_avatar/www.debian-fr.org/clochette/32/8757_2.png) [@Clochette](https://www.debian-fr.org/u/Clochette)\
**Post date:** [Octobre 29, 2017, 10:40 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/9 "2017-10-29T10:40:34Z")

</div>

> [@OverSu](#):
>
> `Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'
> Oct 26 13:51:16 domain.tld /etc/init.d/mysql[2135]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!`

L’erreur est là, il ne faut pas chercher plus loin.

Si le problème ne se situe pas dans le my.cnf à la partie socket = c’est que c’est ailleurs mais grosso modo pour une raison que j’ignore il ne trouve pas son socket et du coup ne démarre pas.

Un peu de lecture :

> **[MariaDB Documentation](https://mariadb.com/docs?q=library%2Ftroubleshooting-connection-issues)**
>
> Comprehensive documentation, release notes and learning resources for all MariaDB products.

---

<div class="post-metadata">

**Author:** ![OverSu](https://www.debian-fr.org/user_avatar/www.debian-fr.org/oversu/32/6092_2.png) [@OverSu](https://www.debian-fr.org/u/OverSu)\
**Post date:** [Octobre 29, 2017, 11:13 UTC](https://www.debian-fr.org/t/mysql-var-run-mysqld-mysqld-sock-no-such-file/74890/10 "2017-10-29T11:13:08Z")

</div>

Merci pour votre aide.

Donc, après avoir lu les liens et essayé diverses choses, j’ai simplement testé d’effacer MySQL (en gardant les tables et BDD) et réinstaller le tout.

A priori ca fonctionne. Divers bug d’importation ect, mais rien d’alarmant.

Edit: J’avais essayé les inno\_force en 2, 3, 4… 🙂

Merci de votre aide !
