问题:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/www/server/data/mysql.sock’ (2)

解决,先看看错误信息

执行: journalctl |grep mysql

错误信息:root@chenjianle-desktop:~# journalctl |grep mysql
12月 17 18:46:32 chenjianle-desktop mysql-systemd-start[724]: MySQL configuration not found at /etc/mysql/my.cnf. Please create one.
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Control process exited, code=exited status=1
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Unit entered failed state.
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Failed with result ‘exit-code’.
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
12月 17 18:46:32 chenjianle-desktop mysql-systemd-start[743]: MySQL configuration not found at /etc/mysql/my.cnf. Please create one.
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Control process exited, code=exited status=1
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Unit entered failed state.
12月 17 18:46:32 chenjianle-desktop systemd[1]: mysql.service: Failed with result ‘exit-code’.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
12月 17 18:46:33 chenjianle-desktop mysql-systemd-start[757]: MySQL configuration not found at /etc/mysql/my.cnf. Please create one.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Control process exited, code=exited status=1
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Unit entered failed state.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Failed with result ‘exit-code’.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
12月 17 18:46:33 chenjianle-desktop mysql-systemd-start[767]: MySQL configuration not found at /etc/mysql/my.cnf. Please create one.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Control process exited, code=exited status=1
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Unit entered failed state.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Failed with result ‘exit-code’.
12月 17 18:46:33 chenjianle-desktop systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
12月 17 18:46:33 chenjianle-desktop mysql-systemd-start[782]: MySQL configuration not found at /etc/mysql/my.cnf. Please create one.

 

发现安装的my.cnf和我用宝塔面板里面指定的配置信息不一致。造成无法启动。

解决办法,新建一个my.cnf.

MySQL configuration not found at /etc/mysql/my.cnf. Please create one.