升级至 12.04 后修复损坏的 myslq-server 包

升级至 12.04 后修复损坏的 myslq-server 包

升级到 12.04 后,mysql 服务器无法启动。

我尝试了很多不同的方法但都没有任何效果。

现在,当我尝试安装它时,我得到:

$  sudo apt-get install mysql-server-5.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  tinyca
The following NEW packages will be installed:
  mysql-server-5.5
0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.
Need to get 0 B/8,708 kB of archives.
After this operation, 31.3 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 243325 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.22-0ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up mysql-server-5.5 (5.5.22-0ubuntu1) ...
120509 20:32:08 [Note] Plugin 'FEDERATED' is disabled.
120509 20:32:08 InnoDB: The InnoDB memory heap is disabled
120509 20:32:08 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120509 20:32:08 InnoDB: Compressed tables use zlib 1.2.3.4
120509 20:32:08 InnoDB: Initializing buffer pool, size = 128.0M
120509 20:32:08 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 67108864 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
120509 20:32:09 [ERROR] Plugin 'InnoDB' init function returned error.
120509 20:32:09 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120509 20:32:09 [ERROR] Unknown/unsupported storage engine: InnoDB
120509 20:32:09 [ERROR] Aborting

120509 20:32:09 [Note] /usr/sbin/mysqld: Shutdown complete

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人可以建议一些方法来解决这个问题吗?或者我必须重新安装整个系统?

提前致谢。

答案1

那个答案非常危险对于任何拥有 mysql 数据库的人来说,因为它会删除所有数据库。而且没有必要执行这样的过程。只需执行以下操作:

sudo touch /etc/apparmor.d/local/usr.sbin.mysqld
service mysqld start

mysql 将恢复正常状态,mysql 将运行并且您的数据库将保持活动状态而不会被删除。

答案2

无需重新安装整个系统。如果您有任何问题,您可以随时

sudo apt-get remove --purge mysql-server
sudo apt-get install mysql-server-5.5

我在安装mysql时遇到的问题如下:

  • 可能是您丢失了文件或文件损坏了/etc/my.cnf(看到有关 .cnf 中的问题的消息了吗?)。如果是这样...

    sudo mv /etc/mysql/my.cnf  /etc/mysql/my.cnf.old 
    sudo cp /etc/mysql/my.cnf.dpkg-old /etc/mysql/my.cnf
    /etc/init.d/mysql start
    

    当然,首先检查您是否有 my.cnf.dpkg.dist

相关内容