mysql 2002 socket,错误2002(HY000):无法通过套接字'/var/lib/mysql/mysql.sock'连接到本地MySQL服务器...

I have installed Centos7 update, removed MariaDB and done a fresh install of MySQL - additionally I have removed it and reinstalled it but everytime I connect to mysql -u root -p I get the titled error. Additionally I have looked at other tickets associated with this but still not making progress. If I run service mysqld restart it says "Redirecting to /bin/systemctl restart mysqld.service" and then just hangs. Really not a linux expert so not sure what is causing this?

解决方案

I had the same problem and found out a few things after digging around. MariaDB is a drop-in replacement for mysql. On the new system, mysql is the MariaDB client (although I'm not clear on what that means). I checked to see if the service was running:

service mysqld status

which indicated:

Redirecting to /bin/systemctl status mysqld.service

mysqld.service

Loaded: not-found (Reason: No such file or directory)

Active: inactive (dead)

In other words, the mysqld service is not running.

Starting the service worked for me:

`systemctl start mariadb.service`

Now all the mysql commands work as expected.

To tie the last knot, enable the service at boot:

`systemctl enable mariadb.service`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值