尝试安装 mysql 时,我总是收到以下错误:
处理时遇到错误:/var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb E:子进程 /usr/bin/dpkg 返回错误代码 (1)
完整内容如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/3,184 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 283762 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.7_5.7.21-0ubuntu0.17.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我已经尝试过这个解决方案
以及 stackoverflow 上几乎所有可用的解决方案,但它不能解决我的问题甚至 mysql 服务器也没有被完全删除sudo apt-get remove --purge mysql-server
。我必须使用 synaptic 管理器将其删除
对我有用的是: 禁用所有第三方存储库,然后再次按照链接的问题说明进行操作
答案1
mysql 服务已在你的系统上运行。尝试
sudo service mysql stop
或者阅读这个:如何启动/停止 mysql 服务器?
之后,您应该检查安装了哪个版本的 mysql,并查看是否真的需要不同的版本。