如何在 Ubuntu 12.04 上恢复 MySQL?

如何在 Ubuntu 12.04 上恢复 MySQL?

升级到 Ubuntu 12.04 删除了 MySQL,我急需恢复它。问题是我在安装它时遇到错误,无论是使用 apt-get 还是 aptitude:

Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.5_5.5.22-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我已经尝试过不同的方法来安装 MySQL,但是都没有成功,正如论坛上的这个帖子所报告的:

http://ubuntuforums.org/showthread.php?t=1998260

我认为我应该提交一个错误,但按照说明我认为最好先在这里询问。

感谢您的阅读。

答案1

如果您仔细阅读日志,您会发现问题在于有一个名为的软件包,其libmysqlclient-dev版本5.5.23-1~dotdeb.0提供了文件/usr/lib/mysql/plugin/ha_example.so。因此,您似乎已从 http://www.dotdeb.org 安装了 mysql。请先尝试删除这些软件包。您可以使用以下命令找出哪些软件包来自那里:

aptitude search "?installed?origin(packages.dotdeb.org)"

删除它们,然后删除/etc/apt/sources.list文件中的相应条目。运行apt-get update,然后重新尝试安装 MySQL 服务器。

答案2

我最终按照 konrad 的提示成功安装了 mysql 服务器sudo apt-get install -f

答案3

我也遇到了这个问题,在尝试运行“apt-get -f install”时出现依赖项失败,但我找到了另一种解决方法:

:~# aptitude install mysql-server
The following packages will be upgraded:
  mysql-server 
1 packages upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
Need to get 0 B/11.5 kB of archives. After unpacking 1,024 B will be used.
The following packages have unmet dependencies:
 mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.34-0ubuntu0.12.04.1) but    5.5.37-0ubuntu0.12.10.1 is installed.
 The following actions will resolve these dependencies:

 Remove the following packages:
1)     mysql-server                
2)     mysql-server-5.5            



Accept this solution? [Y/n/q/?] Y
The following packages will be REMOVED:
  libdbd-mysql-perl{u} libdbi-perl{u} libmysqlclient18{u} 
  libnet-daemon-perl{u} libplrpc-perl{u} libterm-readkey-perl{u} 
  mysql-client-5.5{u} mysql-client-core-5.5{u} mysql-common{u} 
  mysql-server{a} mysql-server-5.5{a} 
0 packages upgraded, 0 newly installed, 11 to remove and 317 not upgraded.
Need to get 0 B of archives. After unpacking 76.9 MB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 215864 files and directories currently installed.)
Removing mysql-server ...
Removing mysql-server-5.5 ...
mysql stop/waiting
Removing mysql-client-5.5 ...
Removing libdbd-mysql-perl ...
Removing libdbi-perl ...
Removing libmysqlclient18:amd64 ...
Removing libplrpc-perl ...
Removing libnet-daemon-perl ...
Removing libterm-readkey-perl ...
Removing mysql-client-core-5.5 ...
Removing mysql-common ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Current status: 0 broken [-1], 317 updates [-7].
:~# apt-get install mysql-server

并且,此后安装(例如即将升级)顺利完成。

希望这对其他人有帮助。

答案4

不确定这是否有帮助,但在升级到 12.04 并遇到与你们相同的问题后,我查看了 error.log 文件并发现了以下内容:

130508 12:09:04 [Note] Plugin 'FEDERATED' is disabled.
130508 12:09:04 InnoDB: The InnoDB memory heap is disabled
130508 12:09:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130508 12:09:04 InnoDB: Compressed tables use zlib 1.2.3.4
130508 12:09:04 InnoDB: Initializing buffer pool, size = 1.0G
130508 12:09:04 InnoDB: Completed initialization of buffer pool
130508 12:09:04 InnoDB: highest supported file format is Barracuda.
130508 12:09:04  InnoDB: Waiting for the background threads to start
130508 12:09:05 InnoDB: 5.5.31 started; log sequence number 569709903822
130508 12:09:05 [ERROR] /usr/sbin/mysqld: unknown variable 'log_bin_trust_routine_creators=1'
130508 12:09:05 [ERROR] Aborting

在注释掉“log_bin_trust_routine_creators=1”之后,它就正常工作了。显然,这是 mysql 5.1 中弃用的选项,并且 5.5 无法识别

希望能帮助到你。

干杯

相关内容