#2002-the server is not responding(or the local mysql server's socket is not correctly

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:


#2002-the server is not responding(or the local mysql server's socket is not correctly

configured)


解决办法:

一种可能是 mysql 的配置文件启用了 bind-address = 127.0.0.1 
 
可以去掉绑定,重启mysqld /etc/init.d/mysqld restart
或者把phpmyadmin 的config.inc.php 参数 $cfg['Servers'][$i]['host'] = 'localhost'; 由localhost 改

为 127.0.0.1
 
第二种可能mysql server socket tmp 设置于php 配置文件设置不一样
 
写一文件phpinfo.php
内容如下:
<?phpinfo()?>
浏览里面的参数,找到mysql.sock在php配置的文件所在位置
在linux 中找到my.cnf
用locate my.cnf or find / -name my.cnf
vi 编辑my.cnf
只需修改:
# The MySQL server
[mysqld]
socket        = /tmp/mysql.sock
改为: socket        = /var/lib/mysql/mysql.sock  即你php要求的mysql.sock的地方
然后重启mysqld 
/etc/init.d/mysqld restart

本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/840302如需转载请自行联系原作者


yangzhimingg

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
5月前
|
关系型数据库 MySQL 数据库
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
|
7月前
|
关系型数据库 MySQL 数据库
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
42 0
|
关系型数据库 MySQL 网络安全
关于对连接数据库时出现1130-host “**” is not allowed to connect to this MySql/mariadb server
关于对连接数据库时出现1130-host “**” is not allowed to connect to this MySql/mariadb server
373 0
|
关系型数据库 MySQL Linux
Linux连接MySQL时的错误:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
连接本地的MySQL数据库引擎时候出现的错误。用mysql_error()函数获取到错误提示:
|
关系型数据库 MySQL
【技术分享】Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘解决方案
【技术分享】Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘解决方案
153 0
【技术分享】Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘解决方案
|
关系型数据库 MySQL
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
817 2
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
|
网络协议 NoSQL Redis
Could not create server TCP listening socket 127.0.0.16379 bind 操作成功
Could not create server TCP listening socket 127.0.0.16379 bind 操作成功
Could not create server TCP listening socket 127.0.0.16379 bind 操作成功
|
关系型数据库 MySQL
Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver’. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.异常错误问题及解决方法。
|
关系型数据库 MySQL Linux
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
110 0

推荐镜像

更多