从 14.04 LTS 升级到 16.04 LTS 破坏了很多东西,现在无法安装 MySql

从 14.04 LTS 升级到 16.04 LTS 破坏了很多东西,现在无法安装 MySql

我看到这个问题已经多次被重复(这里、在启动板上、超级用户等)。我尝试了这里所有的解决方案和建议16.04 升级导致 mysql-server 崩溃, 这里https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1569163, 和这里https://bugs.mysql.com/bug.php?id=72722.但什么也没帮助。

sudo dpkg --configure -a以下是安装失败后的输出

Setting up mysql-server-5.7 (5.7.13-0ubuntu0.16.04.2) ...
+ . /usr/share/debconf/confmodule
++ '[' '!' '' ']'
++ PERL_DL_NONLAZY=1
++ export PERL_DL_NONLAZY
++ '[' '' ']'
++ exec /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-server-5.7.postinst configure ''
+ . /usr/share/debconf/confmodule
++ '[' '!' 1 ']'
++ '[' -z '' ']'
++ exec
++ '[' '' ']'
++ exec
++ DEBCONF_REDIR=1
++ export DEBCONF_REDIR
+ '[' -n '' ']'
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/bin:/usr/bin
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/bin:/usr/bin
+ ERR_LOGGER='logger -p daemon.err -t mysqld_safe -i'
+ set +e
+ invoke stop
+ pathfind invoke-rc.d
+ OLDIFS='  
'
+ IFS=:
+ for p in '$PATH'
+ '[' -x /usr/local/sbin/invoke-rc.d ']'
+ for p in '$PATH'
+ '[' -x /usr/local/bin/invoke-rc.d ']'
+ for p in '$PATH'
+ '[' -x /usr/sbin/invoke-rc.d ']'
+ IFS='     
'
+ return 0
+ invoke-rc.d mysql stop
+ set -e
+ case "$1" in
+ mysql_datadir=/usr/share/mysql
+ mysql_statedir=/var/lib/mysql
+ mysql_rundir=/var/run/mysqld
+ mysql_logdir=/var/log/mysql
+ mysql_cfgdir=/etc/mysql
+ mysql_upgradedir=/var/lib/mysql-upgrade
+ mysql_filesdir=/var/lib/mysql-files
+ mysql_keyringdir=/var/lib/mysql-keyring
+ aa-status --enabled
+ apparmor_parser -r -T -W /etc/apparmor.d/usr.sbin.mysqld
+ /usr/share/mysql-common/configure-symlinks install mysql /etc/mysql/mysql.cnf
+ for d in '$mysql_statedir' '$mysql_filesdir' '$mysql_keyringdir' '$mysql_logdir'
+ '[' '!' -d /var/lib/mysql -a '!' -L /var/lib/mysql ']'
+ chown -R mysql:mysql /var/lib/mysql
+ chmod 0700 /var/lib/mysql
+ for d in '$mysql_statedir' '$mysql_filesdir' '$mysql_keyringdir' '$mysql_logdir'
+ '[' '!' -d /var/lib/mysql-files -a '!' -L /var/lib/mysql-files ']'
+ chown -R mysql:mysql /var/lib/mysql-files
+ chmod 0700 /var/lib/mysql-files
+ for d in '$mysql_statedir' '$mysql_filesdir' '$mysql_keyringdir' '$mysql_logdir'
+ '[' '!' -d /var/lib/mysql-keyring -a '!' -L /var/lib/mysql-keyring ']'
+ chown -R mysql:mysql /var/lib/mysql-keyring
+ chmod 0700 /var/lib/mysql-keyring
+ for d in '$mysql_statedir' '$mysql_filesdir' '$mysql_keyringdir' '$mysql_logdir'
+ '[' '!' -d /var/log/mysql -a '!' -L /var/log/mysql ']'
+ chown -R mysql:mysql /var/log/mysql
+ chmod 0700 /var/log/mysql
+ set +e
+ chown -R 0:0 /usr/share/mysql
+ touch /var/log/mysql/error.log
+ chown -R mysql:adm /var/log/mysql
+ chmod 0750 /var/log/mysql
+ chmod 0640 /var/log/mysql/error.log
+ set -e
+ db_set mysql-server/postrm_remove_database false
+ _db_cmd 'SET mysql-server/postrm_remove_database' false
+ _db_internal_IFS='    
'
+ IFS=' '
+ printf '%s\n' 'SET mysql-server/postrm_remove_database false'
+ IFS='     
'
+ IFS='
'
+ read -r _db_internal_line
+ RET='10 mysql-server/postrm_remove_database doesn'\''t exist'
+ case ${_db_internal_line%%[   ]*} in
+ return 10
+ true
+ dpkg --compare-versions '' le 5.7.13-0ubuntu0~
+ echo 'Renaming removed key_buffer and myisam-recover options (if present)'
Renaming removed key_buffer and myisam-recover options (if present)
+ fix_old_config_options
+ '[' -f /etc/mysql/my.cnf.migrated ']'
+ return 0
+ test_mysqld_startup
+ result=0
++ mysqld --verbose --help --innodb-read-only
+ output=
+ '[' '!' 0 = 0 ']'
+ return 0
+ dc=/etc/mysql/debian.cnf
++ fgrep mysql_upgrade /etc/mysql/debian.cnf
+ '[' -e /etc/mysql/debian.cnf -a -n '[mysql_upgrade]' ']'
++ sed -n 's/^[     ]*password *= *// p' /etc/mysql/debian.cnf
++ head -n 1
+ pass=FDfqfpyjUDJiVbgI
+ sed -i /basedir/d /etc/mysql/debian.cnf
+ chown 0:0 /etc/mysql/debian.cnf
+ chmod 0600 /etc/mysql/debian.cnf
++ ls -A /var/lib/mysql
+ '[' '!' 'auto.cnf
debian-5.1.flag
debian-5.5.flag
debian-5.7.flag
ib_buffer_pool
ibdata1
ib_logfile0
ib_logfile1
mysql
mysql_upgrade_info
performance_schema
test' ']'
+ existingdatabase=1
+ touch /var/lib/mysql/debian-5.7.flag
+ '[' configure = configure ']'
+ APP_PROFILE=/etc/apparmor.d/usr.sbin.mysqld
+ '[' -f /etc/apparmor.d/usr.sbin.mysqld ']'
+ LOCAL_APP_PROFILE=/etc/apparmor.d/local/usr.sbin.mysqld
+ test -e /etc/apparmor.d/local/usr.sbin.mysqld
+ aa-status --enabled
+ apparmor_parser -r -T -W /etc/apparmor.d/usr.sbin.mysqld
+ deb-systemd-helper unmask mysql.service
+ deb-systemd-helper --quiet was-enabled mysql.service
+ deb-systemd-helper enable mysql.service
+ '[' configure = configure ']'
+ '[' -x /etc/init.d/mysql ']'
+ update-rc.d mysql defaults 19 21
+ '[' -x /etc/init.d/mysql ']'
+ invoke-rc.d mysql start
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.
+ exit 1
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: enabled)
   Active: activating (start-post) (Result: exit-code) since Tue 2016-08-16 15:56:55 PDT; 18s ago
  Process: 19414 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 19411 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 19414 (code=exited, status=1/FAILURE);         : 19415 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─19415 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─19480 sleep 1

Aug 16 15:56:55 megatron systemd[1]: Starting MySQL Community Server...
Aug 16 15:56:57 megatron systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

以及来自journalctl -xe

Aug 16 16:01:05 megatron systemd[1]: mysql.service: Unit entered failed state.
Aug 16 16:01:05 megatron systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 16 16:01:05 megatron systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 16 16:01:05 megatron systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Aug 16 16:01:05 megatron systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Aug 16 16:01:07 megatron systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Aug 16 16:01:09 megatron smbd[20383]: pam_unix(samba:session): session closed for user nobody
Aug 16 16:01:09 megatron smbd[20386]: pam_unix(samba:session): session closed for user nobody
Aug 16 16:01:11 megatron smbd[20391]: pam_unix(samba:session): session closed for user nobody
Aug 16 16:01:15 megatron smbd[20398]: pam_unix(samba:session): session closed for user nobody
Aug 16 16:01:36 megatron systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Aug 16 16:01:36 megatron systemd[1]: mysql.service: Unit entered failed state.
Aug 16 16:01:36 megatron systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 16 16:01:36 megatron systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 16 16:01:36 megatron systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Aug 16 16:01:36 megatron systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Aug 16 16:01:38 megatron systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

有人能帮忙吗?我对此束手无策,我不想重新安装。我需要完成此安装,这样我才能安装一些工作软件。

答案1

好的,看来我找到了答案。这解决了问题:

sudo dpkg -P --force depends mysql-server mysql-server-5.7 mysql-common mysql-server-core-5.7 php5-mysql mysql-client-5.7 mysql-client-core-5.7

我在这里找到了解决方案https://ubuntuforums.org/showthread.php?t=1763604&page=3

相关内容