无法通过套接字连接到本地 MySQL 服务器

无法通过套接字连接到本地 MySQL 服务器

我刚刚升级了 kali linux,从那以后 mysql 就一直坏了。启动服务后,mysqlapache2运行命令mysql,然后收到此错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

我检查是否已mysql-server安装,因此我运行apt-get install mysql-server-5.5

这就是我得到的:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package mysql-server-5.5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  mariadb-server-10.1:i386 mysql-common mariadb-server-10.1

E: Package 'mysql-server-5.5' has no installation candidate

答案1

我遇到了类似的错误。这是因为没有安装 mysql-server。但在最新的 Kali 安装中,使用的是 MariaDB 而不是 MySQL。您可以使用以下方式安装服务器:

apt install mariadb-server

相关内容