Linux-Ubuntu:安装MySQL服务器失败:

时间:2018-01-08 08:28:02

标签: mysql linux ubuntu-16.04

我已经安装了apache2,安装了php 7.安装了phpmyadmin。 然后我尝试用我创建的用户创建一个数据库。不幸的是我无法创建数据库,因为我没有正确的权限。所以我决定从头开始删除所有内容(apache2,mysql,php,phpmyadmin)。

要删除MySQL服务器,我使用了以下命令±

sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean

现在我遇到了mysql的安装问题。我想我删除了更多然后我应该删除。

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mysql-server-5.6 : PreDepends: mysql-common (>= 5.5) but it is not 
installable
                Depends: libdbi-perl but it is not installable
                Depends: mysql-client-5.6 (>= 5.6.35-1+deb.sury.org~xenial+0                   
                .1) but it is not going to be installed
              Depends: mysql-common (>= 5.6.22-1~) but it is not installable              

              E: Unable to correct problems, you have held broken packages.

当我使用apt-get update:

root@localhost:~# apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/ondrej/mysql-5.6/ubuntu xenial InRelease
Hit:3 http://ppa.launchpad.net/ondrej/mysql-5.7/ubuntu xenial InRelease
Hit:4 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease

当我使用:sudo apt-get install -f

root@localhost:~# sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt-get clean:什么都不返回

Sudo apt-get -f install:

root@localhost:~# sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt-get -o Debug :: pkgProblemResolver = yes dist-upgrade

root@localhost:~# sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

因为安装不起作用而且我遇到了其他一些错误,所以我也更改了源列表文件。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。 在我的情况下,它与etc / apt目录中的sourcelist文件有关。

我更新了文件

VisualStudio-17

执行命令

# deb cdrom:[Ubuntu-Studio 16.04 LTS _Xenial Xerus_ - Alpha amd64 (20151225)]/ xenial main multiverse restricted universe

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted
bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb-src http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

要应用任何更新,请运行以下命令之一:

sudo apt-get update

请参阅Answer