我没有意识到安装 MariaDB 会覆盖 MySQL 的大部分内容,并使其无法使用——我不知道它们如此相似。
我更愿意继续使用 MySQL,但是当尝试修复我的错误时,再次安装 MySQL 时遇到了问题。
我已经将 /var/lib/msql 文件夹复制到安全位置,并尝试清除所有 MariaDB 和 MySQL 包,但是当我尝试重新安装时出现以下失败:
root@homeserver:/home/ryan# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-server mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/25.2 MB of archives.
After this operation, 179 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libaio1:amd64.
(Reading database ... 240010 files and directories currently installed.)
Preparing to unpack .../0-libaio1_0.3.112-5_amd64.deb ...
Unpacking libaio1:amd64 (0.3.112-5) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../1-libmecab2_0.996-6_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-6) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../2-mysql-server-core-8.0_8.0.18-0ubuntu0.19.10.1_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.18-0ubuntu0.19.10.1) ...
Preparing to unpack .../3-mysql-server-8.0_8.0.18-0ubuntu0.19.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!
当我尝试停止 MySQL 时,它说它没有运行。
有任何想法吗?
这是 Ubuntu 19.04。
答案1
在其他地方找到了答案:
使用:
dpkg -P | grep mysql
dpkg -P | grep mariadb
这将找到所有已安装的软件包。我使用以下命令卸载了所有软件包:
dpkg -P package-name
然后重新启动。