cant connect to local MySQL server through socket /tmp/mysql.sock (2)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: cant connect to local MySQL server through socket /tmp/mysql.sock (2)

mysql -u root -p 连接mysql时 报错:Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

cat /etc/my.cnf查看配置文件指定到的目录

解决

设置下软连接

# 文件所在目录 /data/mysql/tmp/mysql.sock  
ln -s /data/mysql/tmp/mysql.sock /tmp/mysql.sock

再次连接数据库:/data/mysql/bin/mysql -uroot -p


相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
8月前
|
关系型数据库 MySQL 数据库
用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理
用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理
123 0
|
4月前
|
关系型数据库 MySQL 网络安全
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
|
4月前
|
关系型数据库 MySQL 数据库
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
271 0
|
6月前
|
安全 关系型数据库 MySQL
【Python】已解决:pymysql.err.OperationalError:(2003 “Can’t connect to MySQL server on ‘localhost’ ([WinEr
【Python】已解决:pymysql.err.OperationalError:(2003 “Can’t connect to MySQL server on ‘localhost’ ([WinEr
856 1
|
7月前
|
Web App开发 关系型数据库 MySQL
ucenter info:can not connect to MySQL server 报错!怎么解决
ucenter info:can not connect to MySQL server 报错!怎么解决
50 1
|
6月前
|
关系型数据库 MySQL 数据库
2003-Can`t connect to Mysql server on ‘154.8.165.152‘(10038)
2003-Can`t connect to Mysql server on ‘154.8.165.152‘(10038)
|
6月前
|
关系型数据库 MySQL 数据库连接
Cant‘t connect to MySQL server on ‘localhost‘ (10038)
Cant‘t connect to MySQL server on ‘localhost‘ (10038)
|
7月前
|
关系型数据库 MySQL 数据安全/隐私保护
mysql无法启动服务connect to server at ‘localhost‘ failed
mysql无法启动服务connect to server at ‘localhost‘ failed
|
7月前
|
关系型数据库 MySQL 数据库
【已解决】[图文步骤] message from server: “Host ‘172.17.0.1‘ is not allowed to connect to this MySQL server“
【已解决】[图文步骤] message from server: “Host ‘172.17.0.1‘ is not allowed to connect to this MySQL server“
307 0
|
7月前
|
SQL 网络协议 关系型数据库
MySql安装异常解决:1130 - Host ‘11*.17*.6*.23*‘ is not allowed to connect to this MysQL server
MySql安装异常解决:1130 - Host ‘11*.17*.6*.23*‘ is not allowed to connect to this MysQL server
67 0