Falha ao iniciar servidor de banco de dados MariaDB após atualizar para o debian 9

1

Após a atualização para o debian 9, eu recebo este problema, ao tentar fazer um apt-get upgrade : Failed to start MariaDB database server

Aqui está o log:

Setting up mariadb-server-10.1 (10.1.23-9+deb9u1) ...
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-07-05 15:44:03 CEST; 9ms ago
  Process: 9713 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 9623 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR='/usr/bin/galera_recovery'; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 9619 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 9616 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
 Main PID: 9713 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Jul 05 15:43:59 v22015121382329682 systemd[1]: Starting MariaDB database server...
Jul 05 15:44:00 v22015121382329682 mysqld[9713]: 2017-07-05 15:44:00 140711653892672 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 9713 ...
Jul 05 15:44:03 v22015121382329682 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 05 15:44:03 v22015121382329682 systemd[1]: Failed to start MariaDB database server.
Jul 05 15:44:03 v22015121382329682 systemd[1]: mariadb.service: Unit entered failed state.
Jul 05 15:44:03 v22015121382329682 systemd[1]: mariadb.service: Failed with result 'exit-code'.
dpkg: error processing package mariadb-server-10.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of default-mysql-server:
 default-mysql-server depends on mariadb-server-10.1; however:
  Package mariadb-server-10.1 is not configured yet.

dpkg: error processing package default-mysql-server (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on default-mysql-server; however:
  Package default-mysql-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mariadb-server-10.1
 default-mysql-server
 mysql-server

Eu já tentei este tutorial, mas ainda falhei: link

Como posso corrigir esse problema?

    
por Zoker 05.07.2017 / 15:33

2 respostas

0

No tutorial você deve instalar o mariadb-server no lugar do mysql-server. Eu tenho o mesmo problema na instalação do DEBIAN 9 e este comando funcionou para mim:

sudo apt purge mysql*
sudo apt purge mariadb*
sudo apt autoremove
sudo apt autoclean

Verifique se ainda há algo no sistema:

dpkg -l | grep -e mysql -e mariadb 

se a lista estiver vazia, então instale o servidor mariadb:

sudo apt install mariadb-server

Agora tente verificar o status ao parar e iniciar o banco de dados:

Status após a instalação:

sudo systemctl status mysql.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-03-21 16:08:49 CET; 2min 1s ago
 Main PID: 15699 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─15699 /usr/sbin/mysqld

.../..

Verifique o PID:

sudo more /var/run/mysqld/mysqld.pid 
15699

Pare o banco de dados:

sudo systemctl stop mysql.service
sudo systemctl status mysql.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2018-03-21 16:14:35 CET; 1s ago
 Main PID: 15699 (code=exited, status=0/SUCCESS)
   Status: "MariaDB server is down"

.../...

Você pode verificar se o arquivo PID não está presente também

sudo more /var/run/mysqld/mysqld.pid 
more: stat on /var/run/mysqld/mysqld.pid: No file or folder

Inicie o banco de dados:

sudo systemctl start mysql.service
sudo systemctl status mysql.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-03-21 16:14:54 CET; 3s ago
  Process: 15911 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 15908 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
  Process: 15791 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR='/usr/bin/galera_recovery'; [ $? -eq 0 ]   && systemctl set-environment _WSREP_S
  Process: 15787 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 15784 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
 Main PID: 15881 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 26 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           └─15881 /usr/sbin/mysqld

Você pode verificar o arquivo PID que deve estar presente. Pode ajudar em um banco de dados vazio. Se houver algo no banco de dados, você deverá fazer um backup primeiro.

    
por 21.03.2018 / 16:30
0

tente

apt dist-upgrade

ou

apt install aptitude
aptitude install mariadb-server

aptitude tem um resolvedor de dependências muito poderoso

    
por 27.11.2018 / 11:32