安装 MySQL 服务器时出现问题

安装 MySQL 服务器时出现问题

我在安装 mysql 和/或 mariadb 时遇到问题。

我得到以下信息:

sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common
  mysql-server-5.5
Suggested packages:
  tinyca
The following NEW packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common
  mysql-server mysql-server-5.5
0 upgraded, 6 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/4,164 kB of archives.
After this operation, 67.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 104782 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.46-0ubuntu0.14.04.2_all.deb ...
Unpacking mysql-common (5.5.46-0ubuntu0.14.04.2) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.46-0ubuntu0.14.04.2_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.46-0ubuntu0.14.04.2) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client-5.5_5.5.46-0ubuntu0.14.04.2_amd64.deb ...
Unpacking mysql-client-5.5 (5.5.46-0ubuntu0.14.04.2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up mysql-common (5.5.46-0ubuntu0.14.04.2) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 104875 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.46-0ubuntu0.14.04.2_amd64.deb ...
Unpacking mysql-server-5.5 (5.5.46-0ubuntu0.14.04.2) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.46-0ubuntu0.14.04.2_all.deb ...
Unpacking mysql-server (5.5.46-0ubuntu0.14.04.2) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libmysqlclient18:amd64 (5.5.46-0ubuntu0.14.04.2) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up mysql-client-5.5 (5.5.46-0ubuntu0.14.04.2) ...
Setting up mysql-server-5.5 (5.5.46-0ubuntu0.14.04.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package 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 package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ureadahead (0.100.0-16) ...
E: Sub-process /usr/bin/dpkg returned an error code (1)

mariadb-server 也存在完全相同的问题/错误消息。

我尝试过的东西:

sudo dpkg——配置mysql-server-5.5

Setting up mysql-server-5.5 (5.5.46-0ubuntu0.14.04.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.5

sudo apt-get -f 安装

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.5 (5.5.46-0ubuntu0.14.04.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package 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 package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

回显“退出 0”>> /etc/init.d/mysql dpkg --configure -a

Setting up mysql-server-5.5 (5.5.46-0ubuntu0.14.04.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package 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 package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server

这可能是什么原因造成的?我该如何解决?

我确实做了一些谷歌搜索并检查了以前的 askubuntu 帖子,但我尝试过的一切似乎都没有起作用。

谢谢。

答案1

  1. 尝试以下操作,如果不奏效,请尝试第二种方法,或者使用第三种方法安装 MySQL。

清理系统中以前的安装

sudo apt-get purge mysql*
sudo apt-get clean
sudo apt-get 自动删除
sudo apt-get 自动清理
sudo apt-get 更新

最后安装MySQL。

sudo apt-get 安装 mysql-client-core-5.5 mysql-server libmysqlclient-dev

这将安装mysql 服务器根据客户包。libmysqlclient-dev是 ”MySQL 数据库开发文件“。

  1. 首先尝试升级您的发行版,然后安装 MySQL。

升级您的发行版

sudo apt-get 更新
sudo apt-get 升级

然后

sudo apt-get 安装 mysql 客户端 mysql 服务器 libmysqlclient-dev


  1. 从官方网站安装“MySQL 5.5”。


如果你和我一样使用的是 Ubuntu 14.04,请点击使用 Debian 软件包在 Linux 上安装 MySQL 5.5在里面安装和升级 MySQL 5.5页。

答案2

我发现如果你在根目录中进行依赖项配置,它似乎可以工作。

$ sudo -i 
$ sudo dpkg --configure mysql-server

相关内容