当前位置:网站首页>Mac解决 Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)问题
Mac解决 Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)问题
2022-07-24 05:27:00 【cxcaln】
Mac解决 Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)问题
我在mac电脑安装mysql,发现连接失败:
MacBook-Pro:etc chenxianchong$ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
原因很简单,找不到/tmp/mysql.sock这个文件,解决步骤如下:
1、修改my.cnf文件,一般是在/etc/my.cnf目录中
进入这个文件修改,把之前的socket = /tmp/mysql.sock注释掉,然后换另外一个地址
2、对你指定的目录赋予777权限
sudo chmod 777 /etc/mysqlsock/mysql.sock
3、重启mysql
sudo /usr/local/mysql/support-files/mysql.server restart
然后我们再试一下mysql -uroot -p 发现可以登录了
边栏推荐
- 机器学习案例:孕妇吸烟与胎儿健康
- RAID的配置实验
- Special effects - return to the top (kitten effects)
- [esp8266 spot welder] Based on esp8266 for Arduino
- Machine learning case: smoking in pregnant women and fetal health
- 【LVGL(1)】LVGL的简单介绍
- Summary browser object
- Flex layout
- It's not too much to fight a landlord in idea!
- 【LVGL(6)】显示中文设置,制作中文字库
猜你喜欢

FTP服务与实验

LM393 电压比较器及其典型电路介绍

【LVGL】组件的样式的设置、更改、删除API函数

Process and planned task management

Restful API introduction

Take you to understand the inventory deduction principle of MySQL database

磁盘管理和文件系统

Combination of grep and regular

Custom MVC 2.0

Special effects - click the mouse, and a random color of love will appear
随机推荐
Jenkins CI CD
Sed command
Batch implementation of key based authentication using sshpass
DHCP principle and configuration
File system and log analysis
kubernetes简介和架构及其原理
Browser local storage
Learn more about when to use MySQL two locks (table lock and row lock)
【LVGL(4)】对象的事件及事件冒泡
【LVGL(重要)】样式属性API函数及其参数
DNS domain name resolution service
Kubernetes' deployment, service concept, dynamic capacity expansion
我有 7种 实现web实时消息推送的方案,7种!
Solution: exit status 1 and exit status 145 appear when the console uses NVM to control the node version
ESP32超详细学习记录:NTP同步时间
【LVGL】【阶段总结1】
Promise
Customize MVC 3.0
DNS域名解析服务
广度优先搜索(模板使用)