Ubuntu

將系統從 14.04 升級到 16.04 後,我無法安裝 MySQL

  • April 14, 2020

將系統從 14.04 升級到 16.04 後,我無法安裝 MySQL

我試圖讓 MySQL 工作的所有內容都會產生類似的錯誤,如下所示:

  root@alm:~# sudo dpkg --configure -a
  Setting up mysql-server-5.7 (5.7.29-0ubuntu0.16.04.1) ...
  Renaming removed key_buffer and myisam-recover options (if present)
  Job for mysql.service failed because the control process exited with error code. See "systemctl      status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
    mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2020-04-14 11:41:44 EEST; 7ms ago
   Process: 1711 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)

  Process: 1710 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 1700 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited,   status=0/SUCCESS)
  Main PID: 1710 (code=exited, status=1/FAILURE)

  Apr 14 11:41:44 alm.i4ware.fi systemd[1]: Failed to start MySQL Community Se....
  Apr 14 11:41:44 alm.i4ware.fi systemd[1]: mysql.service: Unit entered failed....
  Apr 14 11:41:44 alm.i4ware.fi systemd[1]: mysql.service: Failed with result ....
  Hint: Some lines were ellipsized, use -l to show in full.
  dpkg: error processing package mysql-server-5.7 (--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.7; however:
  Package mysql-server-5.7 is not configured yet.

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

systemctl status mysql.service說:

mysql.service - MySQL Community Server
  Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
  Active: activating (start-post) (Result: exit-code) since Tue 2020-04-14 12:2
 Process: 15717 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
 Process: 15709 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
Main PID: 15717 (code=exited, status=1/FAILURE);         : 15718 (mysql-systemd
  CGroup: /system.slice/mysql.service
          └─control
            ├─15718 /bin/bash /usr/share/mysql/mysql-systemd-start post
            └─15750 sleep 1

Apr 14 12:26:22 alm.i4ware.fi systemd[1]: mysql.service: Service hold-off time o
Apr 14 12:26:22 alm.i4ware.fi systemd[1]: Stopped MySQL Community Server.
Apr 14 12:26:22 alm.i4ware.fi systemd[1]: Starting MySQL Community Server...
Apr 14 12:26:24 alm.i4ware.fi systemd[1]: mysql.service: Main process exited, co
...skipping...
● mysql.service - MySQL Community Server
  Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
  Active: activating (start-post) (Result: exit-code) since Tue 2020-04-14 12:2
 Process: 15717 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
 Process: 15709 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
Main PID: 15717 (code=exited, status=1/FAILURE);         : 15718 (mysql-systemd
  CGroup: /system.slice/mysql.service
          └─control
            ├─15718 /bin/bash /usr/share/mysql/mysql-systemd-start post
            └─15750 sleep 1

Apr 14 12:26:22 alm.i4ware.fi systemd[1]: mysql.service: Service hold-off time o
Apr 14 12:26:22 alm.i4ware.fi systemd[1]: Stopped MySQL Community Server.
Apr 14 12:26:22 alm.i4ware.fi systemd[1]: Starting MySQL Community Server...
Apr 14 12:26:24 alm.i4ware.fi systemd[1]: mysql.service: Main process exited, co

該怎麼辦?

如果沒有其他幫助,請嘗試

  • 將您的 MySQL 數據文件複製到某個安全的地方(外部硬碟驅動器等)
  • 將 Ubuntu 14.04 安裝到臨時虛擬機
  • 將您的 MySQL 數據文件複製到這個新的虛擬機
  • 使用 mysqldump 或類似工具執行數據庫轉儲
  • 將轉儲複製到升級後的 Ubuntu 機器
  • 導入轉儲

引用自:https://serverfault.com/questions/1012214