# Erreur MySQL après upgrade Stretch

**URL:** <https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400>\
**Category:** Support Debian\
**Tags:** mise-à-niveau, mysql, stretch\
**Created:** [Janvier 16, 2019, 12:31 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400 "2019-01-16T00:31:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 16, 2019, 12:31 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/1 "2019-01-16T00:31:39Z")

</div>

Bonjour,  
je viens d’upgrader `Debian 8.11` en `9.6`.  
Tout est ok excepté `MySQL` et `PhpMyAdmin` qui ont foiré pendant l’installe. … sur un serveur de prod… 😨  
Lorsque j’essaye de m’y connecter :

```nohighlight
root@debian:~# mysql -u root -p
  Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

```

```nohighlight
root@debian:~# service mysql status
● mysql.service - LSB: Start/ Stop MySQL Community Server daemon
   Loaded: loaded (/etc/init.d/mysql; generated; vendor preset: enabled)
   Active: active (exited) since Wed 2019-01-16 00:47:29 CET; 2min 22s ago
 Docs: man:systemd-sysv-generator(8)
  Process: 4079 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)

janv. 16 00:47:23 debian mysql[4079]: /etc/init.d/mysql: ligne 41: my_print_defaults : commande introuvable
janv. 16 00:47:23 debian su[4105]: Successful su for mysql by root
janv. 16 00:47:23 debian su[4105]: + ??? root:mysql
janv. 16 00:47:23 debian su[4105]: pam_unix(su:session): session opened for user mysql by (uid=0)
janv. 16 00:47:23 debian mysql[4079]: -su: mysqld_safe : commande introuvable
janv. 16 00:47:29 debian mysql[4079]: ......
janv. 16 00:47:29 debian mysql[4079]: /etc/init.d/mysql: ligne 41: my_print_defaults : commande introuvable
janv. 16 00:47:29 debian mysql[4079]: /etc/init.d/mysql: ligne 41: my_print_defaults : commande introuvable
janv. 16 00:47:29 debian mysql[4079]: MySQL Community Server did not start. Please check logs for more details..
janv. 16 00:47:29 debian systemd[1]: Started LSB: Start/ Stop MySQL Community Server daemon.

```

D’après mes recherches je pense avoir un problème de socket.

```nohighlight
root@debian:~# cat /etc/mysql/my.cnf

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
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
explicit_defaults_for_timestamp

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

log-error = /var/log/mysql/error.log

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

```

Mes bases semblent toujours ici : **`/var/lib/mysql`**  
mais rien dans : **`/var/run/mysqld`**

J’ai grand besoin de votre aide. Qu’est-ce que je peux faire ??? 🙄  
Merci d’avance

---

<div class="post-metadata">

**Author:** ![anon97446390](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@anon97446390](https://www.debian-fr.org/u/anon97446390)\
**Post date:** [Janvier 16, 2019, 2:12 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/2 "2019-01-16T02:12:28Z")

</div>

salut tchup

```plaintext
MySQL Community Server did not start. Please check logs for more details…

```

```plaintext
log-error = /var/log/mysql/error.log

```

J’espère que tu y trouveras des infos.

autrement,

> ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)

> mais rien dans : /var/run/mysqld

Normal sans le service démarré.

> mysqld\_safe : commande introuvable

Il est passé où ce binaire `mysqld_safe` ?

> /etc/init.d/mysql: ligne 41: my\_print\_defaults : commande introuvable

Tu peux aussi aller lire vers cette ligne 41 de `/etc/init.d/mysql`

```auto
mysql --version

```

Peut informer.

> Après un update des packages Debian vous pouvez avoir besoin de refixer les privilèges en tapant :
> 
> `mysql_fix_privilege_tables`.
> 
> Mysql démarrera seulement si vous avez un nom de machine (NdT : hostname) non-numérique qui est résolvable par le fichier /etc/hosts
> 
> Le paquet Debian de MySql server crée un utilisateur nommé debian-sys-maint qui est utilisé pour lancer les tâches cron. Ne le supprimez pas.  
> Si vous le supprimez un `dpkg-reconfigure mysql-server` devrait résoudre le problème.  
> [https://wiki.debian.org/fr/MySql](https://wiki.debian.org/fr/MySql)

```plaintext
apt-cache policy mysql-server
apt-cache policy mysql-client

```

Peut informer aussi.

Sauvegarde tes bases `/var/lib/mysql`.

Tu n’aurais pas fait un upgrade sans tomber les services avant ?

Je suis sans expertise pour tout ça, ce sont des petites idées.

---

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 16, 2019, 8:37 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/3 "2019-01-16T08:37:44Z")

</div>

Bonjour [**r2mi**](https://www.debian-fr.org/u/r2mi) et merci pour ton aide !

1/ le log **`/var/log/mysql/error.log`** est vide même après **`service mysql restart`**!  
2/ rien trouvé avec **`find / -type f -executable -name mysqld_safe`**  
3/ voici la fonction qui ne trouve pas `my_print_defaults`

```nohighlight
get_mysql_option() {
    RESULT=$(my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
    if [-z "$RESULT"];
        then
                RESULT="$3"
    fi
    echo $RESULT
}

```

4/ voici la version de `MySQL` (`MariaDB`)

```nohighlight
root@debian:~# mysql --version
mysql Ver 15.1 Distrib 10.1.37-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

```

5/ reconfiguration de `MySQL Server` impossible

```nohighlight
root@debian:~# dpkg-reconfigure mysql-server
dpkg-query: le paquet « mysql-server » n'est pas installé et aucune information n'est disponible
Utilisez dpkg --info (= dpkg-deb --info) pour examiner les fichiers archives,
 et dpkg --contents (= dpkg-deb --contents) pour afficher leur contenu.
/usr/sbin/dpkg-reconfigure: mysql-server n'est pas installé

```

6/ j’ai sauvegardé mes bases

```nohighlight
cp -r /var/lib/mysql/* /root/crash_mysql/

```

7/ contenu de la fin du log d’hier :

```nohighlight
root@debian:~# zcat /var/log/mysql/error.log.1.gz
2019-01-15 23:30:38 855 [Note] /usr/sbin/mysqld: Shutdown complete
2019-01-15 23:30:38 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
2019-01-15 23:30:38 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-01-15 23:30:38 0 [Note] /usr/sbin/mysqld (mysqld 5.6.34) starting as process 32409 ...
2019-01-15 23:30:38 32409 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2019-01-15 23:30:38 32409 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2019-01-15 23:30:38 32409 [Note] Plugin 'FEDERATED' is disabled.
2019-01-15 23:30:38 32409 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-01-15 23:30:38 32409 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-15 23:30:38 32409 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-15 23:30:38 32409 [Note] InnoDB: Memory barrier is not used
2019-01-15 23:30:38 32409 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-01-15 23:30:38 32409 [Note] InnoDB: Using Linux native AIO
2019-01-15 23:30:38 32409 [Note] InnoDB: Using CPU crc32 instructions
2019-01-15 23:30:38 32409 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-01-15 23:30:38 32409 [Note] InnoDB: Completed initialization of buffer pool
2019-01-15 23:30:38 32409 [Note] InnoDB: Highest supported file format is Barracuda.
2019-01-15 23:30:38 32409 [Note] InnoDB: 128 rollback segment(s) are active.
2019-01-15 23:30:38 32409 [Note] InnoDB: Waiting for purge to start
2019-01-15 23:30:39 32409 [Note] InnoDB: 5.6.34 started; log sequence number 127410191
2019-01-15 23:30:39 32409 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-01-15 23:30:39 32409 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2019-01-15 23:30:39 32409 [Note] Server socket created on IP: '127.0.0.1'.
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.events_waits_current is wrong. Expected 19, found 16. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.events_waits_history is wrong. Expected 19, found 16. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.events_waits_history_long is wrong. Expected 19, found 16. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Incorrect definition of table performance_schema.events_waits_summary_by_thread_by_event_name: expected column 'THREAD_ID' at position 0 to have type bigint(20), found type int(11).
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_user_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_account_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.file_summary_by_event_name is wrong. Expected 23, found 5. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.file_summary_by_instance is wrong. Expected 25, found 6. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'host_cache' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Incorrect definition of table performance_schema.mutex_instances: expected column 'LOCKED_BY_THREAD_ID' at position 2 to have type bigint(20), found type int(11).
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'objects_summary_global_by_type' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Incorrect definition of table performance_schema.rwlock_instances: expected column 'WRITE_LOCKED_BY_THREAD_ID' at position 2 to have type bigint(20), found type int(11).
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'setup_actors' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'setup_objects' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_index_usage' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_table' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'table_lock_waits_summary_by_table' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.threads is wrong. Expected 14, found 3. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_current' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_history' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_history_long' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_thread_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_account_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_user_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_host_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_stages_summary_global_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_current' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_history' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_history_long' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_thread_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_account_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_user_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_host_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_global_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2019-01-15 23:30:39 32409 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure
2019-01-15 23:30:39 32409 [Note] Event Scheduler: Loaded 0 events
2019-01-15 23:30:39 32409 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.34' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
2019-01-15 23:32:17 32409 [Note] /usr/sbin/mysqld: Normal shutdown
2019-01-15 23:32:17 32409 [Note] Giving 0 client threads a chance to die gracefully
2019-01-15 23:32:17 32409 [Note] Event Scheduler: Purging the queue. 0 events
2019-01-15 23:32:17 32409 [Note] Shutting down slave threads
2019-01-15 23:32:17 32409 [Note] Forcefully disconnecting 0 remaining clients
2019-01-15 23:32:17 32409 [Note] Binlog end
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'partition'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_METRICS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMPMEM'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_CMP'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_LOCKS'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'INNODB_TRX'
2019-01-15 23:32:17 32409 [Note] Shutting down plugin 'InnoDB'
2019-01-15 23:32:17 32409 [Note] InnoDB: FTS optimize thread exiting.
2019-01-15 23:32:17 32409 [Note] InnoDB: Starting shutdown...
2019-01-15 23:32:18 32409 [Note] InnoDB: Shutdown completed; log sequence number 127410201
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'ARCHIVE'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'BLACKHOLE'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'MyISAM'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'MRG_MYISAM'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'CSV'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'MEMORY'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'sha256_password'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'mysql_old_password'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'mysql_native_password'
2019-01-15 23:32:18 32409 [Note] Shutting down plugin 'binlog'
2019-01-15 23:32:18 32409 [Note] /usr/sbin/mysqld: Shutdown complete
2019-01-15 23:32:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

```

😓

---

<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:** [Janvier 16, 2019, 11:57 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/4 "2019-01-16T11:57:23Z")

</div>

En premier lieu on ne fais jamais une upgrade en production sans différente vérification/essai et à minima un dump.

as-tu après mis à jour effectuer un mysql\_upgrade comme demandé dans le log que tu fourni :

```auto
2019-01-15 23:30:39 32409 [ERROR] Column count of mysql.events_waits_history_long is wrong. Expected 19, found 16. Created with MySQL 50553, now running 50634. Please use mysql_upgrade to fix this error.

```

peux-tu tenter de mettre de côté ton my.cnf et de purger réinstaller mariadb et redémarrer ton mysql ?

Si il permet de fourni du log a ce moment là nous aurons plus de grain à moudre 😕

Avec du systemd tu peux utiliser journalctl -u SERVICE\_QUE\_TU\_DEBUG

Pareil je vois passer des lignes /etc/init.d … ??? tu utilise pas systemd et les unit service 😓

---

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 16, 2019, 12:17 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/5 "2019-01-16T12:17:07Z")

</div>

Bonjour Clochette

```
root@debian:~# mysql_upgrade
-su: mysql_upgrade : commande introuvable

```

Je peux essayer mais à vrai dire j’ai peur d’atteindre le point de non retour en réinstallant… De plus je comprend pas bien pourquoi des fois c’est MariaDB et et des fois MySQL 😕

Honnêtement je ne maitrise en rien SystemD & co… j’ai installé basiquement debian8.2 il y a longtemps pour monter un serveur Web multi sites et j’ai lancé un dist-upgrade hier soir… Je ne sais donc pas “rectifier” l’utilisation de SystyemD

---

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 16, 2019, 12:19 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/6 "2019-01-16T12:19:07Z")

</div>

si ça peut aider…

```nohighlight
root@debian:~# dpkg --list
[...]
ii mariadb-client-10.1 10.1.37-0+deb9u1 amd64 MariaDB database client binaries
ii mariadb-client-core-10.1 10.1.37-0+deb9u1 amd64 MariaDB database core client binaries
ii mariadb-common 10.1.37-0+deb9u1 all MariaDB common metapackage
[...]
ii mysql-apt-config 0.8.0-1 all Auto configuration for MySQL APT Repo.
ii mysql-common 5.8+1.0.2 all MySQL database common files, e.g. /etc/mysql/my.cnf
rc mysql-community-server 5.6.34-1debian8 amd64 MySQL Server
rc mysql-server-5.5 5.5.53-0+deb8u1 amd64 MySQL database server binaries and system database setup

```

si je comprend bien j’ai un **client MariaDB** et un **serveur MySQL 5.5**??? (alors que j’étais en 5.6)

```nohighlight
root@debian:~# dpkg-reconfigure mysql-server-5.5
/usr/sbin/dpkg-reconfigure: mysql-server-5.5 est cassé ou partiellement installé

```

```nohighlight
root@debian:~# mysqld_safe --skip-grant-tables
-su: mysqld_safe : commande introuvable

```

```nohighlight
root@debian:~# mysqlcheck -c -u root --all-databases
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") when trying to connect

```

```nohighlight
root@debian:~# systemctl status mariadb.service
Unit mariadb.service could not be found.

```

---

<div class="post-metadata">

**Author:** ![anon97446390](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@anon97446390](https://www.debian-fr.org/u/anon97446390)\
**Post date:** [Janvier 16, 2019, 4:20 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/7 "2019-01-16T16:20:09Z")

</div>

> [@tchup](#):
>
> 6/ j’ai sauvegardé mes bases
> 
> ```auto
> cp -r /var/lib/mysql/* /root/crash_mysql/
> 
> ```

J’aurais utilisé `cp -a` ou `cp -xa`

> [@Clochette](#):
>
> peux-tu tenter de mettre de côté ton my.cnf et de purger réinstaller mariadb et redémarrer ton mysql ?

> [@tchup](#):
>
> Je peux essayer mais à vrai dire j’ai peur d’atteindre le point de non retour en réinstallant…

À mon avis, pour avoir une première chance de retrouver le service et les BDD il faudrait réinstaller les paquets `mysql-*` au plus proche de la version cassée ; voire la même. en préservant les éléments de configuration au préalable.

```plaintext
apt update
apt-cache policy mysql-apt-config mysql-common mysql-community-server mysql-server-5.5
# donner le résultat

```

Et probablement utiliser `mysql_upgrade` après la réinstallation.

> **[MySQL :: MySQL 8.0 Reference Manual :: 6.4.5 mysql\_upgrade — Check and...](https://dev.mysql.com/doc/refman/8.0/en/mysql-upgrade.html)**

Pour faire une migration dans les règles vers `mariadb-server` après.

[https://mariadb.com/kb/fr/mariadb-vs-mysql-features/](https://mariadb.com/kb/fr/mariadb-vs-mysql-features/)  
[https://mariadb.com/kb/fr/mariadb-vs-mysql-features/#liens-connexes](https://mariadb.com/kb/fr/mariadb-vs-mysql-features/#liens-connexes)

---

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 16, 2019, 9:20 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/8 "2019-01-16T21:20:47Z")

</div>

BONNE NOUVELLE !!! 😀  
réparation réussie et “presque” tout refonctionne.  
Après m’être décidé à réinstaller complétement `MySQL` :

```nohighlight
root@debian:~# rm -rf /etc/mysql
root@debian:~# apt install mysql-common mysql-server mysql-community-server
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
mysql-common is already the newest version (5.8+1.0.2).
mysql-common passé en « installé manuellement ».
Certains paquets ne peuvent être installés. Ceci peut signifier que vous avez demandé l'impossible, ou bien, si vous utilisez la distribution unstable, que certains paquets n'ont pas encore été créés ou ne sont pas sortis d'Incoming.
L'information suivante devrait vous aider à résoudre la situation :

Les paquets suivants contiennent des dépendances non satisfaites :
 mysql-community-server : Dépend: mysql-common (= 5.6.34-1debian8)
                          Recommande: mysql-client (= 5.6.34-1debian8) mais ne sera pas installé
E: Impossible de corriger les problèmes, des paquets défectueux sont en mode « garder en l'état ».

```

Cette erreur m’a mis la puce à l’oreille

```nohighlight
Impossible de corriger les problèmes, des paquets défectueux sont en mode « garder en l'état ».

```

```nohighlight
root@debian:~# dpkg --audit
Les paquets suivants sont à demi configurés, probablement à cause de problèmes survenus lors de la première configuration. Il faudrait réessayer de les configurer en utilisant `dpkg --configure <paquet`> ou l'option `configure` du menu de `dselect` :
 phpmyadmin MySQL web administration tool
 mysql-server MySQL database server binaries and system database setup

```

puis

```nohighlight
root@debian:~# apt remove phpmyadmin mysql-server
root@debian:~# apt install mysql-server

```

ensuite `service mysql status` n’indique plus d’erreur … 🙂  
mais encore impossible de se reconnecter à `MySQL` (sans password ou celui avant le souci)

```nohighlight
root@debian:~# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

```

Heureusement que la procédure de réinitialisation du password root a fonctionné : [https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password](https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password)

Puis je me suis retrouvé avec un souci de driver `PDO/php/mysql` … et `mysqli` pour faire tourner `PhpMyAdmin`. Après 2h de debug (impossible de réparer les extensions sous `PHP5`), j’ai résolu le problème en passant à `PHP7`

```nohighlight
a2dismod php5.6
a2enmod php7.0
service apache2 restart

```

Voila ! en espérant que ça serve à quelqu’un 😉

---

<div class="post-metadata">

**Author:** ![tchup](https://www.debian-fr.org/user_avatar/www.debian-fr.org/tchup/32/4415_2.png) [@tchup](https://www.debian-fr.org/u/tchup)\
**Post date:** [Janvier 23, 2019, 12:30 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/9 "2019-01-23T12:30:00Z")

</div>

Bon… après quelques jours d’utilisation. J’ai un souci de paramétrage…  
Bizarrement **je ne trouve aucun fichier de conf dans debian !!!** 😨  
Je ré-ouvre donc ce topic… vous me direz si je dois plutôt en ouvrir un nouveau. 😉

```nohighlight
root@debian:~# mysql –verbose –help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

```

```nohighlight
root@debian:~# ps ax | grep '[m]ysqld'
48549 ? Ssl 3:08 /usr/sbin/mysqld

```

```nohighlight
root@debian:~# find / -name my.cnf
/etc/alternatives/my.cnf
/var/lib/dpkg/alternatives/my.cnf

```

```nohighlight
root@debian:~# cat /etc/alternatives/my.cnf
cat: /etc/alternatives/my.cnf: Aucun fichier ou dossier de ce type

```

```nohighlight
root@debian:~# ls -la /etc/alternatives/my.cnf
lrwxrwxrwx 1 root root 22 janv. 16 00:11 /etc/alternatives/my.cnf -> /etc/mysql/mariadb.cnf

```

```nohighlight
root@debian:~# cat /etc/mysql/mariadb.cnf
cat: /etc/mysql/mariadb.cnf: Aucun fichier ou dossier de ce type

```

```nohighlight
root@debian:~# ls -la /etc/mysql/
total 20
drwxr-xr-x 3 root root 4096 janv. 16 16:30 .
drwxr-xr-x 92 root root 4096 janv. 16 16:27 ..
-rw------- 1 root root 277 janv. 16 16:30 debian.cnf
-rwxr-xr-x 1 root root 1509 août 10 2017 debian-start
drwxr-xr-x 2 root root 4096 janv. 16 16:30 mariadb.conf.d

```

```nohighlight
root@debian:~# ls -la /etc/mysql/mariadb.conf.d/
total 16
drwxr-xr-x 2 root root 4096 janv. 16 16:30 .
drwxr-xr-x 3 root root 4096 janv. 16 16:30 ..
-rw-r--r-- 1 root root 1032 août 10 2017 50-mysqld_safe.cnf
-rw-r--r-- 1 root root 3719 août 8 18:32 50-server.cnf

```

```nohighlight
root@debian:~# cat /var/lib/dpkg/alternatives/my.cnf
auto
/etc/mysql/my.cnf
/etc/mysql/mariadb.cnf
200
/etc/mysql/my.cnf.fallback
100

```

```nohighlight
root@debian:~# cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
basedir = /usr

```

```nohighlight
root@debian:~# cat /etc/mysql/debian-start
#!/bin/bash
#
# This script is executed by "/etc/init.d/mysql" on every (re)start.
#
# Changes to this file will be preserved when updating the Debian package.
#
# NOTE: This file is read only by the traditional SysV init script, not systemd.
#

source /usr/share/mysql/debian-start.inc.sh

if [-f /etc/default/mysql]; then
  . /etc/default/mysql
fi

MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="${MYCHECK_RCPT:-root}"

## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables.

# The following commands should be run when the server is up but in background
# where they do not block the server start and in one shell instance so that
# they run sequentially. They are supposed not to echo anything to stdout.
# If you want to disable the check for crashed tables comment
# "check_for_crashed_tables" out.
# (There may be no output to stdout inside the background process!)

# Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade
# process in the middle.
trap "" SIGHUP
(
  upgrade_system_tables_if_necessary;
  check_root_accounts;
  check_for_crashed_tables;
) >&2 &

exit 0

```

C’est quoi ce délire ???  
où est passé **`/etc/mysql/my.cnf`**??? 🙄

---

<div class="post-metadata">

**Author:** ![anon97446390](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@anon97446390](https://www.debian-fr.org/u/anon97446390)\
**Post date:** [Janvier 23, 2019, 1:06 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/10 "2019-01-23T13:06:11Z")

</div>

Bonjour tchup,

> [@tchup](#):
>
> ```plaintext
> root@debian:~# mysql –verbose –help | grep -A 1 "Default options"
> Default options are read from the following files in the given order:
> /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
> 
> ```

> [@tchup](#):
>
> ```auto
> MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
> ...
> 
> ```

Le paramètre `--defaults-file` outrepasse tout autre emplacement de configuration.

[https://stackoverflow.com/questions/2482234/how-do-i-find-the-mysql-my-cnf-location](https://stackoverflow.com/questions/2482234/how-do-i-find-the-mysql-my-cnf-location)

> [@tchup](#):
>
> C’est quoi ce délire ???  
> où est passé **`/etc/mysql/my.cnf`**??? 🙄

Tu l’a effacé.

> [@tchup](#):
>
> root@debian:~# rm -rf /etc/mysql

---

<div class="post-metadata">

**Author:** ![anon97446390](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@anon97446390](https://www.debian-fr.org/u/anon97446390)\
**Post date:** [Janvier 23, 2019, 2:09 UTC](https://www.debian-fr.org/t/erreur-mysql-apres-upgrade-stretch/78400/11 "2019-01-23T14:09:55Z")

</div>

> [@tchup](#):
>
> Bon… après quelques jours d’utilisation. J’ai un souci de paramétrage…  
> Je ré-ouvre donc ce topic… vous me direz si je dois plutôt en ouvrir un nouveau.

Il va falloir détailler ton souci.  
Je ne pourrai pas t’aider vraisemblablement ; je ne connais pas assez le sujet.

Pourquoi-pas un nouveau topic oui ?
