将系统从 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
该怎么办?
答案1
如果没有其他帮助,请尝试
- 将 MySQL 数据文件复制到安全的地方(外部硬盘等)
- 将 Ubuntu 14.04 安装到临时虚拟机
- 将 MySQL 数据文件复制到这个新的虚拟机
- 使用 mysqldump 或类似工具来转储数据库
- 将转储复制到升级后的 Ubuntu 机器
- 导入转储