como reinstalar o mysql?

33

Uma atualização de software quebrou, entre outras coisas, o mysql e eu ainda não consegui recuperá-lo.

Causa suspeita: eu tinha um disco de inicialização quase cheio; a atualização preencheu o disco antes de concluir e, assim, deixou tudo bagunçado. Eu dei mais disco ao sistema e movi / var para sua própria partição. Eu ainda estou tentando, sem sucesso, reviver o mysql.

Abaixo está o que eu tentei até agora (tudo como root). Primeiro, o mysql não inicia (443). Tentativas de corrigir (444, 445) falham. Tentativas para remover mysql e (?) Apparmor falham (446, 7, 8). Uma tentativa mais enérgica de remover o mysql parece ter sucesso (449) e os erros anteriores não são mais vistos (450, 1, 2). O Mysql não pode ser reconfigurado porque não está mais lá (453), mas tentar reinstalá-lo retorna as mensagens de erro antigas e estamos de volta à estaca zero (454).

Eu também verifiquei esta questão (mesmo que no meu caso não tenha quebrado por causa de uma atualização para 12.04: já estava trabalhando em 12.10) Corrigindo o pacote myslq-server quebrado após a atualização para 12.04 e tentei as sugestões de lá (458, 461, 462) sem sucesso.

O que mais devo fazer?

Isso é no 3.5.0-25-genérico # 39-Ubuntu SMP seg 25 de fevereiro 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
    
por st01 08.03.2013 / 23:47

6 respostas

67

Primeiro remova o MySQL:

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

Em seguida, reinstale:

sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
    
por Joren 21.09.2013 / 23:46
10

No Ubuntu 16.04 a maneira de consertá-lo no meu caso foi ( por favor bancos de dados de backup primeiro, bancos de dados serão perdidos ):

sudo apt remove --purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo rm -rf /var/lib/mysql*
sudo apt install mysql-server

(De alguma forma, minhas chamadas anteriores para apt purge mysql-server não pareciam ter sucesso. Achei que apt purge foo era equivalente a apt remove --purge foo ...)

    
por knocte 11.07.2016 / 10:04
9

Eu estava recebendo os mesmos erros e tentei a maioria das etapas que você fez, com os mesmos resultados. O seguinte finalmente funcionou para mim.

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

Depois disso, o mysql é instalado normalmente.

    
por Tom Damon 09.05.2013 / 19:27
1

Não sei qual foi o caso para mim, mas as outras soluções não funcionaram, continuaram a dar um erro. Eu tentei isso apt-get purge mysql-* , então autoremove e autoclean . Depois que a instalação foi bem.

**

Certifique-se de fazer backup de seus bancos de dados, o comando acima pode excluí-los também

**

    
por dav 27.03.2015 / 14:13
0

Se você acabou de executar

sudo apt-get update
sudo apt-get install mysql-server

ele irá atualizar o mysql e isso corrigiu o problema que eu tive depois de atualizar para 16.04 lts.

Ou apenas execute

sudo apt-get install lamp-server^

para atualizar todos os pacotes do servidor.

    
por user558503 30.08.2016 / 15:54
-5

Instale o phpMyAdmin nos repositórios padrão do Ubuntu. Então corra:

dpkg --configure mysql-server-5.5
apt-get purge mysql-server mysql-client mysql-common mysql-client-5.5 mysql-server-5.5
apt-get autoremove
apt-get autoclean
apt-get update
apt-get install  mysql-server
service mysql restart
    
por user277883 04.05.2014 / 18:43