无法在本地安装 mysql 服务器

无法在本地安装 mysql 服务器

我用户是ubuntu 14.04版本。

所以我无法安装mysql-server。

    Unpacking mysql-server-core-5.6 (5.6.27-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up mysql-common (5.6.25-3+deb.sury.org~trusty+1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.6.
(Reading database ... 219897 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.27-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-5.6 (5.6.27-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.6.25-3+deb.sury.org~trusty+1_all.deb ...
Unpacking mysql-server (5.6.25-3+deb.sury.org~trusty+1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libmysqlclient18:amd64 (5.6.25-3+deb.sury.org~trusty+1) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up mysql-client-core-5.6 (5.6.27-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.6 (5.6.27-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.6 (5.6.27-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.6 (5.6.27-0ubuntu0.14.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--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.6; however:
  Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                          Processing triggers for ureadahead (0.100.0-16) ...
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.6 (5.6.27-0ubuntu0.14.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--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.6; however:
  Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.6
 mysql-server

我尝试清除所有已安装的与 mysql 相关的软件包。结果如下:

apt-get purge mysql-server
apt-get purge mysql-common
rm -rf /var/log/mysql
rm -rf /var/log/mysql.*
rm -rf /var/lib/mysql
rm -rf /etc/mysql
# and then:
apt-get install mysql-server --fix-missing --fix-broken

但即使这样我仍然无法安装 mysql。

有什么建议么?

答案1

首先删除 MySQL:

sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
sudo apt-get autoremove
sudo apt-get autoclean

然后再次安装MySQL:

sudo apt-get update
sudo apt-get install mysql-server -y

答案2

我想这是因为这个错误。您的机器内存不足。转到/etc/mysql/my.cnf并降低max_connection到较低的值。然后重新启动安装:

sudo apt-get install -f

相关内容