mysql 安装问题 - Ubuntu 18.04 bionic

mysql 安装问题 - Ubuntu 18.04 bionic

在登录到 MySQL,我收到警告:

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

我在一个页面上看到,这是由于没有安装 mysql-server 造成的:重新安装

~$ sudo apt-get install --reinstall mysql-server
[sudo] password for krd: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

mysql地位说:

~$ service mysql status
● mysql.service - MySQL Community Server
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

尝试完全安装 mysqll 并重新安装,但问题仍然存在。我在安装任何其他软件时也遇到了下面显示的 mysql-server-5.7 问题,但系统在安装时失败。

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
 xterm : Depends: libutempter0 (>= 1.1.5) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

套接字错误通常指向服务未启动,并且您稍后收到的错误(inactive (dead))也指向那个方向。

最可能的原因是您的配置文件中有一个无效选项(如 所示Reason: Invalid argument)。

尝试/etc/my.cnf通过以下方式备份

mv /etc/my.cnf /etc/my.cnf.bak

然后通过重新启动服务

systemctl restart mysql

如果有效,则移回配置文件并逐行注释后重新启动服务,直到找出哪一个导致中断。

相关内容