2016-10-28 143 views
0

我運行Ubuntu 16.04(乾淨安裝 - 不升級)。 MySQL運行正常 - 但當我嘗試更新MySQL時出現此錯誤:在Ubuntu上MySQL升級失敗16.04

apt-get install 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 
2 not fully installed or removed. 
After this operation, 0 B of additional disk space will be used. 
Setting up mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ... 
Checking if update is needed. 
Checking server version. 
Running queries to upgrade MySQL server. 
Checking system database. 
mysql.columns_priv         OK 
mysql.db           OK 
mysql.engine_cost         OK 
mysql.event          OK 
mysql.func           OK 
mysql.general_log         OK 
mysql.gtid_executed        OK 
mysql.help_category        OK 
mysql.help_keyword         OK 
mysql.help_relation        OK 
mysql.help_topic         OK 
mysql.innodb_index_stats       OK 
mysql.innodb_table_stats       OK 
mysql.ndb_binlog_index        OK 
mysql.plugin          OK 
mysql.proc           OK 
mysql.procs_priv         OK 
mysql.proxies_priv         OK 
mysql.server_cost         OK 
mysql.servers          OK 
mysql.slave_master_info       OK 
mysql.slave_relay_log_info       OK 
mysql.slave_worker_info       OK 
mysql.slow_log          OK 
mysql.tables_priv         OK 
mysql.time_zone         OK 
mysql.time_zone_leap_second      OK 
mysql.time_zone_name        OK 
mysql.time_zone_transition       OK 
mysql.time_zone_transition_type     OK 
mysql.user           OK 
The sys schema is already up to date (version 1.5.1). 
Checking databases. 

ALL DATABASES RETURNED OK 

Error occurred: Error during call to mysql_check. 
mysql_upgrade failed with exit status 4 
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 
E: Sub-process /usr/bin/dpkg returned an error code (1) 

雖然它運行,我不喜歡錯誤。你們有什麼想法如何解決這個問題?

正在運行dpkg -l | grep的MySQL允許:

dpkg -l | grep mysql 
ii libdbd-mysql-perl     4.033-1ubuntu0.1          amd64  Perl5 database interface to the MySQL database 
ii libmysqlclient20:amd64    5.7.16-0ubuntu0.16.04.1        amd64  MySQL database client library 
ii mysql-client      5.7.16-0ubuntu0.16.04.1        all   MySQL database client (metapackage depending on the latest version) 
ii mysql-client-5.7     5.7.16-0ubuntu0.16.04.1        amd64  MySQL database client binaries 
ii mysql-client-core-5.7    5.7.16-0ubuntu0.16.04.1        amd64  MySQL database core client binaries 
ii mysql-common      5.7.16-0ubuntu0.16.04.1        all   MySQL database common files, e.g. /etc/mysql/my.cnf 
iU mysql-server      5.7.16-0ubuntu0.16.04.1        all   MySQL database server (metapackage depending on the latest version) 
iF mysql-server-5.7     5.7.16-0ubuntu0.16.04.1        amd64  MySQL database server binaries and system database setup 
ii mysql-server-core-5.7    5.7.16-0ubuntu0.16.04.1        amd64  MySQL database server binaries 
ii php-mysql       1:7.0+45+deb.sury.org~xenial+1      all   MySQL module for PHP [default] 
ii php5.6-mysql      5.6.27-1+deb.sury.org~xenial+1      amd64  MySQL module for PHP 
ii php7.0-mysql      7.0.12-1+deb.sury.org~xenial+1      amd64  MySQL module for PHP 

感謝

+0

嘗試在超級用戶或ask-ubuntu上提問。 – AnAmuser

+0

請回答你的問題 – surfer190

回答

0

我碰到的這個我自己,我相信這與做升級過程的停止/啓動/重新啓動MySQL的。

下面是我在嘗試升級MySQL失敗後所做的解決方法。

  1. 正常啓動MySQL,通常以「service mysql start」爲根。
  2. 作爲root執行「mysql_upgrade --defaults-file =/etc/mysql/debian.cnf」。希望它應該完成,沒有錯誤或表明MySQL已經升級。
  3. 用你最喜歡的編輯器編輯文件「/var/lib/dpkg/info/mysql-server-5.7.postinst」。在第320行左右(取決於版本)找到「mysql_upgrade --defaults-file =/etc/mysql/debian.cnf || result = $?」行。如果應該看起來像「#mysql_upgrade --defaults-file =/etc/mysql/debian.cnf || result = $?」,那麼註釋掉(用'#'前綴)。保存該文件並退出編輯器。
  4. 重新運行升級過程,它應該指示MySQL現在已升級。

在某些時候,我會進一步深入瞭解爲什麼在升級過程中「mysql_upgrade ...」調用失敗,而不是從命令行單獨執行。但我沒有經過幾次升級,沒有問題使用這種方法。

希望這會有所幫助。

'Grip