Não é possível excluir o mysql-server no ubuntu 12.04.5 TLS

1

Estou tentando reinstalar o mysql-server-5.6, mas não posso fazer nada, toda vez que tenho essa estranha mensagem:

root@ps****:/home/nikitasorokin# apt-get remove --purge mysql-server-5.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  mysql-client-core-5.6
Use 'apt-get autoremove' to remove it.
The following packages will be REMOVED:
  mysql-server-5.6*
0 upgraded, 0 newly installed, 1 to remove and 941 not upgraded.
1 not fully installed or removed.
After this operation, 52.5 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 122623 files and directories currently installed.)
Removing mysql-server-5.6 (5.6.25-0ubuntu1) ...
stop: Unknown instance: 
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-5.6 (--purge):
 subprocess installed pre-removal script returned error exit status 1
stop: Unknown instance: 
invoke-rc.d: initscript mysql, action "stop" failed.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.6
E: Sub-process /usr/bin/dpkg returned an error code (1)

Eu sei que a principal recomendação é desinstalar completamente o mysql e todos os seus componentes, mas não posso fazer isso. Por favor, você poderia considerar alguma solução?

    
por Nikita Sorokine 08.11.2015 / 17:04

1 resposta

1
  1. Edite o script post-installation

    sudo nano /var/lib/dpkg/info/mysql-server-5.6.postinst
    
  2. Pesquise a função

    invoke() {
        if [ -x /usr/sbin/invoke-rc.d ]; then
            invoke-rc.d mysql 
        else
            /etc/init.d/mysql 
        fi
    }
    

    e substitua por

    invoke() {
        echo
        #if [ -x /usr/sbin/invoke-rc.d ]; then
        #     invoke-rc.d mysql 
        #else
        #     /etc/init.d/mysql 
        #fi
    }
    
  3. Salve o arquivo

  4. Edite o script pre-removal

    sudo nano /var/lib/dpkg/info/mysql-server-5.6.prerm
    
  5. Pesquise as linhas

    if [ -x "/etc/init.d/mysql" ] || [ -e "/etc/init/mysql.conf" ]; then
            invoke-rc.d mysql stop || exit $?
    fi
    

    e substitua

    if [ -x "/etc/init.d/mysql" ] || [ -e "/etc/init/mysql.conf" ]; then
            echo
            #invoke-rc.d mysql stop || exit $?
    fi
    
  6. Edite o script post-removal

    sudo nano /var/lib/dpkg/info/mysql-server-5.6.postrm
    
  7. Pesquisar

    # New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
    # variants in Ubuntu.
    case "" in
      remove|disappear)
        /usr/share/mysql-common/configure-symlinks remove mysql "$mysql_cfgdir/mysql.cnf"
      ;;
    esac
    

    e substitua

    # New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
    # variants in Ubuntu.
    case "" in
      remove|disappear)
        # /usr/share/mysql-common/configure-symlinks remove mysql "$mysql_cfgdir/mysql.cnf"
      ;;
    esac
    
  8. Salve o arquivo e execute o comando novamente

    sudo apt-get remove --purge mysql-server-5.6
    
por A.B. 08.11.2015 / 17:19