当前位置:网站首页>MySQL找不到mysql.sock文件的临时解
MySQL找不到mysql.sock文件的临时解
2022-06-30 16:55:00 【Selondier】
连接数据库时报错:Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";
原因:1)mysql服务没启动;2)sock文件路径设置错误 ;3)sock文件所在目录的权限问题;4)这个文件直接丢失了
1)检查服务有没有启动
2)在my.cnf文件中查看socket参数指定的路径,查看该路径有没有访问权限
3)前往该路径下查看是否存在mysql.sock文件,如果sock文件不存在,可先尝试使用find命令搜索该文件,如果搜索不到,可重启mysql服务,会自动生成一个。然后将该文件复制到soctek参数指定的路径下去。或者建立一个软链接,比如这个文件在/var/lib/mysql.sock,socket参数指定的路径是/tmp/mysql.sock。我们就可以这样创建:ln -s /var/lib/mysql.sock /tmp/mysql.sock,创建完之后,再尝试连接
4)如果依旧错误,可使用TCP/IP来连接
mysql -u root -h 数据库服务器的IP -p
或 mysql -u root -h 127.0.0.1 -p
边栏推荐
- LeetCode之合并二叉树
- Simulation of campus network design based on ENSP
- Hcip (Huawei Senior Network Security Engineer) (Experiment 8) (MPLS basic experiment)
- 抖音最新Xbogus,signature生成js逆向分析
- Force deduction solution summary 1175- prime number arrangement
- News management system based on SSM
- Type ~ storage ~ variable in C #
- 每日面试1题-如何防止CDN防护被绕过
- Advanced customization of uni app [day13]
- 分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
猜你喜欢

C# Winform程序界面优化实例

漏洞复现----38、ThinkPHP5 5.0.23 远程代码执行漏洞

Alexnet of CNN classic network (Theory)

ABAP publish restful service

漏洞复现----35、uWSGI PHP 目录遍历漏洞 (CVE-2018-7490)

Flutter custom component

MySQL reports that the column timestamp field cannot be null

Redis (VI) - master-slave replication

Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole

IEEE TBD SCI impact factor increased to 4.271, ranking Q1!
随机推荐
分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
If you want to learn software testing, you must see series, 2022 software testing engineer's career development
What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
火山引擎入选国内首个《边缘计算产业全景图》
Unity开发bug记录100例子(第1例)——打包后shader失效或者bug
Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases
Sign up for Huawei cloud proposition in the "Internet +" competition, and you can take many gifts!
阿里云ECS导入本地,解决部署的问题
Word中添加代码块(转载)
【云驻共创】Huawei iConnect使能物联终端一触即联
腾讯云安装mysql数据库
Lenovo's "dual platform" operation and maintenance solution helps to comprehensively improve the intelligent management ability of the intelligent medical industry
MySQL advanced - basic index and seven joins
Post office - post office issues (dynamic planning)
港科大&MSRA新研究:关于图像到图像转换,Finetuning is all you need
Advanced embedded application of uni app [day14]
uni-app进阶之内嵌应用【day14】
Apache 解析漏洞(CVE-2017-15715)_漏洞复现
LRN local response normalization