mysql登陆启动报错 ERROR 2002 (HY000) 解决方法

  • Post author:
  • Post category:mysql


报错信息

登陆数据库报错:`

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2 “No such file or directory”)`


重启服务报错:

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.


查看服务状态信息:`systemctl status mariadb.service

● mariadb.service – MariaDB 10.1 database server

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Mon 2019-04-15 17:16:38 UTC; 4s ago

Process: 2864 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=1/FAILURE)

Process: 2841 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status&#