当前位置:网站首页>MySQL找不到mysql.sock文件的臨時解
MySQL找不到mysql.sock文件的臨時解
2022-06-30 18:25: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
边栏推荐
- 云安全日报220630:IBM数据保护平台发现执行任意代码漏洞,需要尽快升级
- Daily interview 1 question - basic interview question of blue team - emergency response (1) basic idea process of emergency response +windows intrusion screening idea
- [cloud resident co creation] Huawei iconnect enables IOT terminals to connect at one touch
- In distributed scenarios, do you know how to generate unique IDs?
- Development and construction of NFT mining tour gamefi chain tour system
- Advanced customization of uni app [day13]
- 现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
- Word中添加代码块(转载)
- Design and principle of tubes responsive data system
- Flink series: checkpoint tuning
猜你喜欢

程序员女友给我做了一个疲劳驾驶检测

Redis (IX) - enterprise level solution (II)

基于SSH的网上商城设计

Redis (VII) - sentry

LRN local response normalization

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

Thinking on large file processing (upload, download)

Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases

C# Winform程序界面优化实例

MIT科技评论2022年35岁以下创新者名单发布,含AlphaFold作者等
随机推荐
TeamTalk WinClient编译问题及解决方案
火山引擎入选国内首个《边缘计算产业全景图》
Tensorflow2 ten must know for deep learning
TiDB Dashboard里面可以写sql执行吗
hdfs上的数据导入到clickhouse用什么方式最快呢?spark通过jdbc导入,还是hdfs
每日面试1题-如何防止CDN防护被绕过
现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
【义修换届大礼包】
Do you write API documents or code first?
这里数据过滤支持啥样的sql语句
程序员女友给我做了一个疲劳驾驶检测
C# Winform程序界面优化实例
国内离线安装 Chrome 扩展程序的方法总结
Openlayers roller shutter map
力扣解法汇总1175-质数排列
New research of HKUST & MsrA: about image to image conversion, finishing is all you need
Ardunio esp32 obtains real-time temperature and humidity in mqtt protocol (DH11)
ASP. Net password encryption and password login
Volcano engine was selected into the first "panorama of edge computing industry" in China
Unity实战之一个脚本实现雷达图