解决方案

解决方案

所以我清除了 mysql-server 包,然后尝试在 Ubuntu 20.04 上安装它,但由于某些配置问题,它无法运行。我发现它甚至没有停止,而且似乎会自动再次运行,无论如何我都无法停止它

gediminas@ubuntu-g:~$ sudo ps aux | grep mysql
systemd+    9177  5.5  2.2 2123136 364052 ?      Ssl  21:21   0:00 mysqld
gedimin+    9354  0.0  0.0  20200  2548 pts/0    S+   21:21   0:00 grep --color=auto mysql
gediminas@ubuntu-g:~$ sudo pkill mysql
gediminas@ubuntu-g:~$ sudo ps aux | grep mysql
gedimin+    9365  0.0  0.0  20200  2652 pts/0    S+   21:21   0:00 grep --color=auto mysql
gediminas@ubuntu-g:~$ sudo ps aux | grep mysql
systemd+    9432 26.0  1.9 722716 317524 ?       Ssl  21:21   0:00 mysqld
gedimin+    9553  0.0  0.0  20200   664 pts/0    S+   21:22   0:00 grep --color=auto mysql
gediminas@ubuntu-g:~$ sudo ps aux | grep mysql
systemd+    9432 41.0  2.2 1926528 363848 ?      Ssl  21:21   0:00 mysqld
gedimin+    9585  0.0  0.0  20200   664 pts/0    S+   21:22   0:00 grep --color=auto mysql
gediminas@ubuntu-g:~$ sudo ps aux | grep mysql
systemd+    9432 41.0  2.2 1926528 363848 ?      Ssl  21:21   0:00 mysqld
gedimin+    9588  0.0  0.0  20200   660 pts/0    S+   21:22   0:00 grep --color=auto mysql

systemctl status mysql显示:

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
     Active: activating (start) since Sat 2021-07-24 21:43:57 EEST; 1s ago
    Process: 21011 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 21019 (mysqld)
     Status: "Server startup in progress"
      Error: 98 (Address already in use)
      Tasks: 17 (limit: 19032)
     Memory: 331.6M
     CGroup: /system.slice/mysql.service
             └─21019 /usr/sbin/mysqld

liep. 24 21:43:57 ubuntu-g systemd[1]: Starting MySQL Community Server...

发送了一些垃圾邮件后,它显示一次失败

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2021-07-24 21:44:35 EEST; 270ms ago
    Process: 21763 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 21771 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 21771 (code=exited, status=1/FAILURE)
     Status: "Server startup in progress"
      Error: 98 (Address already in use)

liep. 24 21:44:36 ubuntu-g systemd[1]: mysql.service: Scheduled restart job, restart counter is at 139.
liep. 24 21:44:36 ubuntu-g systemd[1]: Stopped MySQL Community Server.
liep. 24 21:44:36 ubuntu-g systemd[1]: Starting MySQL Community Server...

当我清除所有 mysql 包并尝试安装时mysql-server出现此错误

update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-server-8.0 (8.0.25-0ubuntu0.20.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 29427
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script 

subprocess returned error exit status 1
    No apport report written because the error message indicates its a followup error from a previous failure.


dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.11) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我安装mysql-server并运行 dpkg -l 'mysql*' 时,我得到

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version                 Architecture Description
+++-=====================-=======================-============-=================================================>
un  mysql-client-5.7      <none>                  <none>       (no description available)
ii  mysql-client-8.0      8.0.25-0ubuntu0.20.04.1 amd64        MySQL database client binaries
un  mysql-client-core-5.7 <none>                  <none>       (no description available)
ii  mysql-client-core-8.0 8.0.25-0ubuntu0.20.04.1 amd64        MySQL database core client binaries
ii  mysql-common          5.8+1.0.5ubuntu2        all          MySQL database common files, e.g. /etc/mysql/my.c>
un  mysql-common-5.6      <none>                  <none>       (no description available)
iU  mysql-server          8.0.25-0ubuntu0.20.04.1 all          MySQL database server (metapackage depending on t>
un  mysql-server-5.5      <none>                  <none>       (no description available)
un  mysql-server-5.7      <none>                  <none>       (no description available)
iF  mysql-server-8.0      8.0.25-0ubuntu0.20.04.1 amd64        MySQL database server binaries and system databas>
un  mysql-server-core-5.7 <none>                  <none>       (no description available)
ii  mysql-server-core-8.0 8.0.25-0ubuntu0.20.04.1 amd64        MySQL database server binaries

mysql-server:
  Installed: 8.0.25-0ubuntu0.20.04.1
  Candidate: 8.0.25-0ubuntu0.20.04.1
  Version table:
 *** 8.0.25-0ubuntu0.20.04.1 500
        500 http://lt.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://lt.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
        100 /var/lib/dpkg/status
     8.0.19-0ubuntu5 500
        500 http://lt.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://lt.archive.ubuntu.com/ubuntu focal/main i386 Packages

解决方案

碰巧的是,mysql-server 包刚刚坏了,所以修复方法如下:

  1. 重新启动计算机并按住 Shift 键启动,它必须带你进入GNU BRUB 菜单
  2. 选择Ubuntu 的高级选项
  3. 选择Ubuntu,带有 Linux X.XX.X-XX(恢复模式)
  4. 然后在恢复菜单只需选择修复损坏的包

相关内容