尝试使用 apt-get 安装 mysql,但失败
# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mysql-server-5.5
Suggested packages:
tinyca
The following NEW packages will be installed:
mysql-server mysql-server-5.5
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,726 kB of archives.
After this operation, 31.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-5.5 i386 5.5.24-0ubuntu0.12.04.1 [8,714 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server all 5.5.24-0ubuntu0.12.04.1 [11.7 kB]
Fetched 8,726 kB in 12s (686 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 30953 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
egrep: /etc/mysql/: No such file or directory
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.24-0ubuntu0.12.04.1_all.deb) ...
Processing triggers for man-db ...
Setting up mysql-server-5.5 (5.5.24-0ubuntu0.12.04.1) ...
runlevel:/var/run/utmp: No such file or directory
120810 17:25:06 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
120810 17:25:06 [Note] Plugin 'FEDERATED' is disabled.
120810 17:25:06 InnoDB: The InnoDB memory heap is disabled
120810 17:25:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120810 17:25:06 InnoDB: Compressed tables use zlib 1.2.3.4
120810 17:25:06 InnoDB: Initializing buffer pool, size = 128.0M
120810 17:25:06 InnoDB: Completed initialization of buffer pool
120810 17:25:06 InnoDB: highest supported file format is Barracuda.
120810 17:25:06 InnoDB: Waiting for the background threads to start
120810 17:25:07 InnoDB: 1.1.8 started; log sequence number 1595675
120810 17:25:07 [ERROR] Aborting
120810 17:25:07 InnoDB: Starting shutdown...
120810 17:25:07 InnoDB: Shutdown completed; log sequence number 1595675
120810 17:25:07 [Note]
runlevel:/var/run/utmp: No such file or directory
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
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)
知道什么地方出了问题吗?
[更新] 这是由于模板不好
答案1
这可能是由几种不同的原因造成的,其中之一就是文件/目录权限,mysql 版本/操作系统不匹配,或者只是包错误。很难说你遇到了哪些问题。你可以尝试直接从 mysql 下载或 percona 中使用软件包,这通常更容易安装。
如果您可以找到该二进制文件,请尝试运行以下命令:
mysql_install_db --user=mysql --no-defaults
这可能会解决问题。否则,请尝试更新您的操作系统,清除 mysql 包,然后重新安装。
答案2
我在刚安装的 Ubuntu 12.04 x86-64 服务器上运行了 apt-get install mysql-server 命令,mysql-server 成功安装。
看起来你的 Ubuntu 安装有问题。我建议重新安装或尝试从源代码安装 mysql。
答案3
清除 mysql-common 并尝试再次安装 mysql-server:
apt-get purge mysql-common
apt-get install mysql-server