我用db在我的php脚本中得到了这个错误:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)在phpmyadmin上:
#2002 Cannot log in to the MySQL server有什么问题,我该怎么解决呢?我安装了灯服务器..。
发布于 2011-12-28 12:02:37
看来mysql服务器没有运行。
在正常的mysql安装中,可以使用以下命令检查服务器是否正在运行:service mysql status
要启动它,只需运行service mysql start。
发布于 2015-03-11 14:50:44
在Ubuntu14.04下,它正在运行,但套接字既不存在,也不存在文件。将数据库连接主机替换为= 127.0.0.1。
发布于 2017-09-17 11:40:10
在我的例子中,本地Debian 8服务器在我休假时已经关闭,当我重新启动它时,它已经从DHCP服务器上获取了另一个IP地址。
我需要获得这样的新IP地址:
sudo ifconfig eth0 | grep 'inet addr' | cut -d':' -f2 | cut -d' ' -f1然后我需要编辑我的my.cnf文件:
vim /etc/mysql/my.cnf查找本节:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 192.168.0.42并将其更改为与正确的IP地址匹配:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 192.168.0.53在那之后,我没有问题让服务器重新启动。
https://askubuntu.com/questions/90978
复制相似问题