升级 MySQL 服务器问题

升级 MySQL 服务器问题

我无法升级 MySQL 服务器。以下是我尝试的方法:

我首先发出此命令来更新包列表:

sudo apt-get update

然后,通过以下方式升级:

sudo apt-get upgrade

显示以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.28-0ubuntu0.12.04.2) but 5.5.31-0ubuntu0.12.04.1 is installed
E: Unmet dependencies. Try using -f.

显然安装了较新的版本(但为什么?我没有手动安装)。好的,正如它所建议的那样,我发出命令尝试修复:

sudo apt-get -f install

输出如下:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mysql-server mysql-server-5.5
Suggested packages:
  tinyca mailx
The following packages will be upgraded:
  mysql-server mysql-server-5.5
2 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
2 not fully installed or removed.
Need to get 0 B/8889 kB of archives.
After this operation, 64.5 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_HK.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: dependency problems prevent configuration of mysql-server-5.5:
 mysql-server-5.5 depends on mysql-server-core-5.5 (= 5.5.28-0ubuntu0.12.04.2); however:
  Version of mysql-server-core-5.5 on system is 5.5.31-0ubuntu0.12.04.1.
dpkg: error processing mysql-server-5.5 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我尝试使用网上一些人建议的另一个命令:

sudo apt-get -f upgrade

输出相同。除了重新安装 MySQL 服务器,我还能做什么?

使用 Ubuntu 服务器 12.04 LTS

答案1

我遇到过这种情况,但问题是,在执行了 之后,sudo apt-get update它不知何故没有获得 的最新版本mysql-server,只有 的最新版本mysql-server-core。我建议先执行另一个sudo apt-get update,然后继续安装包

sudo apt-get install mysql-server

如果这不起作用则重新安装:

sudo apt-get install --reinstall mysql-server

如果这不起作用,那么只需purge打包mysql-server-core,然后再次安装mysql-server

sudo apt-get purge mysql-server-core mysql-server-core-5.5

sudo apt-get install mysql-server

如果这不起作用,那么就疯狂地这样做:

sudo apt-get clean

sudo apt-get autoclean

sudo apt-get purge mysql-server*

sudo apt-get install mysql-server

作为最后的手段,我会清除、重新启动、安装。

相关内容