我已经安装了 Centos7 更新,删除了 MariaDB 并完成了 MySQL 的全新安装 - 此外,我已经删除并重新安装了它,但每次连接到 mysql -u root -p 时,我都会收到标题错误。此外,我查看了与此相关的其他票证,但仍未取得进展。如果我运行 service mysqld restart 它说“重定向到/bin/systemctl restart mysqld.service”然后挂起。真的不是 Linux 专家,所以不确定是什么原因造成的?
最佳答案
我遇到了同样的问题,在四处挖掘后发现了一些事情。 MariaDB 是 mysql 的直接替代品。在新系统上,mysql 是 MariaDB 客户端(虽然我不清楚这意味着什么)。我检查了服务是否正在运行:
service mysqld status
表示:
Redirecting to /bin/systemctl status mysqld.service mysqld.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)
也就是说,mysqld服务没有运行。
启动服务对我有用:`systemctl start mariadb.service`
现在所有 mysql 命令都按预期工作。
为了打结,请在启动时启用该服务:`systemctl enable mariadb.service`
关于mysql - 错误 2002 (HY000) : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26163704/