Ubuntu 上的 mysql 安装问题

Ubuntu 上的 mysql 安装问题

我尝试在我的 ubuntu 上安装 mysql 和 mysql 社区版本。但一直失败。这似乎是环境问题,因为相同的安装命令在云 ubuntu VM 上运行。但是,无法找出问题所在,在 google 和这个论坛上也检查了一些现有问题。请建议在哪里检查正确的日志以及可能的修复方法

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

以下是一些日志:

Processing triggers for libc-bin (2.27-3ubuntu1) ...
/sbin/ldconfig.real: file /usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudnn.so.7 is truncated

/sbin/ldconfig.real: file /usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudnn.so.7.3.1 is truncated

Processing triggers for systemd (237-3ubuntu10.22) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up mysql-client-core-5.7 (5.7.26-0ubuntu0.18.04.1) ...
Setting up mysql-client-5.7 (5.7.26-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.26-0ubuntu0.18.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)
Specified filename /var/lib/mysql/ibdata1 does not exist.
Initialization of mysqld failed: 0
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2019-07-16 12:45:50 UTC; 7ms ago
  Process: 24009 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggersfor systemd (237-3ubuntu10.22) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果我尝试社区安装,也会遇到类似的错误。还尝试下载和安装 deb 包,但都失败了。还尝试了 mysql 8 和 5 版本。
还清除了现有的 mysql 安装并删除了 mysql 文件:sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*

在评论中询问 journalctl -xe log.. (没有生成日志!):

Jul 15 14:26:05 ALDTGPAIAPP1 su[20535]: - /dev/pts/40 user1:user1
Jul 16 07:31:33 ALDTGPAIAPP1 su[28802]: Successful su for user1 by user1
Jul 16 07:31:33 ALDTGPAIAPP1 su[28802]: + /dev/pts/43 user1:user1
Jul 16 07:31:33 ALDTGPAIAPP1 su[28802]: pam_unix(su:session): session opened for user user1 by (uid=1535129255)
Jul 16 11:51:46 ALDTGPAIAPP1 sudo[8246]: [lsass-pam] [module:pam_lsass]pam_sm_authenticate error [login:user1][err
Jul 16 12:03:46 ALDTGPAIAPP1 su[31664]: pam_unix(su:session): session closed for user user2
(base) user1@ALDTGPAIAPP1:/data/softs$ date
Tue Jul 16 15:53:18 UTC 2019

答案1

删除使用

sudo apt remove --purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*


并尝试安装

sudo apt 安装 mysql 服务器 mysql 客户端 mysql 通用

相关内容