web-dev-qa-db-fra.com

comment réinstaller mysql?

Une mise à jour du logiciel a été interrompue, entre autres choses, mysql et moi n’avons pas encore été en mesure de le récupérer.

Cause suspectée: le disque de démarrage était presque plein. la mise à niveau a rempli le disque avant de terminer et a donc tout laissé dans le pétrin. J'ai donné plus de disque au système et déplacé/var vers sa propre partition. J'essaie toujours en vain de faire revivre mysql.

Ci-dessous, ce que j’ai essayé jusqu’à présent (tout en tant que root). Tout d'abord, mysql ne démarre pas (443). Les tentatives de réparation (444, 445) échouent. Les tentatives pour supprimer mysql et (?) Apparmor échouent (446, 7, 8). Une tentative plus énergique de supprimer mysql semble réussir (449) et les erreurs précédentes ne sont plus observées (450, 1, 2). Mysql ne peut pas être reconfiguré car il n'est plus là (453) mais si vous tentez de le réinstaller, les anciens messages d'erreur sont restitués et nous revenons à la case départ (454).

J'ai aussi vérifié cette question (même si dans mon cas, cela ne s'est pas cassé à cause d'une mise à jour vers 12.04: il travaillait déjà sur 12.10) Correction du paquetage myslq-server cassé après la mise à jour vers 12.04 et j'ai essayé les suggestions dans (458, 461, 462) en vain.

Que dois-je faire d'autre?

Ceci est sur 3.5.0-25-generic # 39-Ubuntu SMP Lundi 25 février 18:26:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

    443  service mysql start
         start: Job failed to start

    444  dpkg-reconfigure mysql-server-5.5
         /usr/sbin/dpkg-reconfigure: mysql-server-5.5
         is broken or not fully installed

    445  apt-get -f install
         ...
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         dpkg: dependency problems prevent configuration of
         mysql-server:
         mysql-server depends on mysql-server-5.5; however:
         Package mysql-server-5.5 is not configured yet.
         dpkg: error processing mysql-server (--configure):
         dependency problems - leaving unconfigured
         No apport report written because the error message
         indicates its a followup error from a previous failure.
         Errors were encountered while processing:
           mysql-server-5.5
           mysql-server
         E: Sub-process /usr/bin/dpkg returned an error code (1)

    446  apt-get remove mysql-server
         ...
         Removing mysql-server ...
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         No apport report written because MaxReports is reached already
         Errors were encountered while processing:
           mysql-server-5.5
         E: Sub-process /usr/bin/dpkg returned an error code (1)


    447  apt-get remove apparmor
         ...
         Package 'apparmor' is not installed, so not removed
         0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
         1 not fully installed or removed.
         After this operation, 0 B of additional disk space will be used. 
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         Errors were encountered while processing:
           mysql-server-5.5
         E: Sub-process /usr/bin/dpkg returned an error code (1)


    448  apt-get remove mysql-server
         Reading package lists... Done
         Building dependency tree       
         Reading state information... Done
         Package 'mysql-server' is not installed, so not removed
         0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
         1 not fully installed or removed.
         After this operation, 0 B of additional disk space will be used.
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         Errors were encountered while processing:
           mysql-server-5.5
         E: Sub-process /usr/bin/dpkg returned an error code (1)

    449  dpkg -r mysql-server-5.5
         (Reading database ... 322156 files and directories
         currently installed.)
         Removing mysql-server-5.5 ...
         Processing triggers for man-db ...
         Processing triggers for ureadahead ...

    450  apt-get remove mysql-server
         Reading package lists... Done
         Building dependency tree        
         Reading state information... Done
         Package 'mysql-server' is not installed, so not removed
         0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    451  apt-get remove apparmor
         Reading package lists... Done
         Building dependency tree       
         Reading state information... Done
         Package 'apparmor' is not installed, so not removed
         0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    452  apt-get -f install
         Reading package lists... Done
         Building dependency tree       
         Reading state information... Done
         0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    453  dpkg-reconfigure mysql-server-5.5
         /usr/sbin/dpkg-reconfigure: mysql-server-5.5 is broken
         or not fully installed

    454  apt-get install mysql-server
         Reading package lists... Done
         Building dependency tree       
         Reading state information... Done
         The following extra packages will be installed:
           mysql-server-5.5
         Suggested packages:
           tinyca mailx
         The following NEW packages will be installed:
           mysql-server mysql-server-5.5
         0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
         Need to get 0 B/8,851 kB of archives.
         After this operation, 32.8 MB of additional disk space
         will be used.
         Do you want to continue [Y/n]? 
         Preconfiguring packages ...
         Selecting previously unselected package mysql-server-5.5.
         (Reading database ... 322081 files and directories
         currently installed.)
         Unpacking mysql-server-5.5 (from 
         .../mysql-server-5.5_5.5.29-0ubuntu0.12.10.1_AMD64.deb) ...
         Selecting previously unselected package mysql-server.
         Unpacking mysql-server (from 
         .../mysql-server_5.5.29-0ubuntu0.12.10.1_all.deb) ...
         Processing triggers for ureadahead ...
         Processing triggers for man-db ...
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         dpkg: dependency problems prevent configuration of mysql-server:
           mysql-server depends on mysql-server-5.5; however:
         Package mysql-server-5.5 is not configured yet.
         dpkg: error processing mysql-server (--configure):
         dependency problems - leaving unconfigured
         No apport report written because the error message
         indicates its a followup error from a previous failure.
         Errors were encountered while processing:
           mysql-server-5.5
           mysql-server
         E: Sub-process /usr/bin/dpkg returned an error code (1)


    458  apt-get remove --purge mysql-server
         Reading package lists... Done
         Building dependency tree       
         Reading state information... Done
         The following packages will be REMOVED:
           mysql-server*
         0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
         2 not fully installed or removed.
         After this operation, 116 kB disk space will be freed.
         Do you want to continue [Y/n]? 
         (Reading database ... 322159 files and directories
         currently installed.)
         Removing mysql-server ...
         Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...
         start: Job failed to start
         invoke-rc.d: initscript mysql, action "start" failed.
         dpkg: error processing mysql-server-5.5 (--configure):
         subprocess installed post-installation script
         returned error exit status 1
         Errors were encountered while processing:
           mysql-server-5.5
         E: Sub-process /usr/bin/dpkg returned an error code (1)

    461  touch /etc/apparmor.d/local/usr.sbin.mysqld
         (no output)

    462  service mysql start
         start: Job failed to start
36
st01

Tout d'abord, supprimez MySQL:

Sudo apt purge mysql-server mysql-client mysql-common
Sudo apt autoremove
Sudo mv -iv /var/lib/mysql /var/tmp/mysql-backup
Sudo rm -rf /var/lib/mysql*

Puis réinstallez:

Sudo apt update
Sudo apt install mysql-server
Sudo mysql_install_db
Sudo /usr/bin/mysql_secure_installation
77
Joren

Dans Ubuntu 16.04, le moyen de résoudre ce problème dans mon cas était (sauvegardez d'abord les bases de données, les bases de données seront perdues):

Sudo apt remove --purge mysql-server mysql-client mysql-common
Sudo apt autoremove
Sudo mv -iv /var/lib/mysql /var/tmp/mysql-backup
Sudo rm -rf /var/lib/mysql*
Sudo apt install mysql-server

(D'une certaine manière, mes appels précédents à apt purge mysql-server n'ont pas semblé aboutir. Je pensais que apt purge foo était équivalent à apt remove --purge foo...)

12
knocte

J'obtenais exactement les mêmes erreurs et j'ai essayé la plupart des étapes que vous avez faites, avec les mêmes résultats. Ce qui suit a finalement fonctionné pour moi.

apt-get purge mysql-server mysql-client mysql-common mysql-client-5.5 mysql-server-5.5

Après cela, mysql s'est installé normalement.

8
Tom Damon

Je ne suis pas sûr de ce qui a été le cas pour moi, mais les autres solutions n'ont pas fonctionné et ont continué à donner une erreur. J'ai essayé ce apt-get purge mysql-*, puis autoremove et autoclean. Après cette installation était bien.

**

Assurez-vous de sauvegarder vos bases de données, la commande ci-dessus peut également les supprimer.

**

1
dav

Pour la version MySQL 5.7, j'ai supprimé MySQL comme décrit précédemment:

Sudo apt purge mysql-server mysql-client mysql-common
Sudo apt autoremove
Sudo rm -rf /var/lib/mysql*

Et installé avec l'aide:

Sudo apt-get update
Sudo apt-get install mysql-server
mysql_secure_installation

Pour tester si tout fonctionne:

systemctl status mysql.service

source

0
Viktorminator

Si vous courez juste

Sudo apt-get update
Sudo apt-get install mysql-server

cela va mettre à jour mysql et cela corrige le problème que j'avais après la mise à jour à 16.04 lts.

Ou simplement courir

Sudo apt-get install lamp-server^

mettre à jour tous les packages du serveur.

0
user558503