问题: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.

 

错误信息:

PHP Warning: PHP Startup: Unable to load dynamic library ‘ext\php_ui.dll’ – 找不到指定的模块。
in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library ‘ext\php_ui.dll’ – 找不到指定的模块。
in Unknown on line 0

原因和解决:

虽然我把扩展复制到ext目录和配置文件中也写了。也复制到windows/system32/下。但是文档也有描述应该复制到和php.exe同一级目录下。如下图紫色框的内容复制到php.exe同一级目录

然后再次运行则警告消失了