Can't connect to local MySQL server through socket '/tmp/mysql.sock'
来源:互联网 发布:消费返利系统源码 编辑:程序博客网 时间:2024/05/22 08:26
Xtrabackup做备份时遇到下面错误信息MySQL server: Can't connect to local MySQL server through socket '/tmp/mysql.so‘(2)
[root@MySQL-DB ~]# innobackupex --defaults-file=/usr/my.cnf --user=root --password=password /mnt/resource/mysql_backup
160322 22:28:43 innobackupex: Starting the backup operation
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
160322 22:28:43 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327.
160322 22:28:43 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: (null)
Failed to connect to MySQL server: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
出现这种情况是因为我修改了my.cnf中参数datadir,但是没有修改socket参数(参数为空),所以出现这个错误。另外我估计更换MySQL数据目录后,如果没有正确配置也会出现这个错误. 我们首先找到对应的mysql.sock文件位置,然后修改my.cnf中的参数scoket值,重启MySQL服务即可解决
[root@MySQL-DB mysql_backup]# find / -name "mysql.sock"
/var/lib/mysql/mysql.sock
另外,其实我这篇文章ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)里介绍的建立软连接也可解决这个问题。
另外,在网上也有种偏方解决这个问题,即指定--host=127.0.0.1也可避免这个错误,我测试确实也能解决问题。不过这个是个治标不治本的方法.
innobackupex --defaults-file=/usr/my.cnf --user=root --password=password --host=127.0.0.1 /mnt/resource/mysql_backup
参考资料:
http://www.cnblogs.com/fuhj02/p/3541173.html
阅读全文
0 0
- ERROR 2002: Can't connect to local MySQL server through socket '/tmp/tmp/mysql.sock' (2)
- ERROR 2002: Can't connect to local MySQL server through socket '/tmp/tmp/mysql.sock' (2)
- 解决mysql启动问题: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- mysql连接错误: Can’t connect to local MySQL server through socket /tmp/mysql.sock
- Django +MySQL Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- mysql运行中问题Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- mysql Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- [mysql]Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- Mysql error 2002 (HY000) : Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- mysql error 2002 (HY000) : Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- 记录mysql错误:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 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'
- php error Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- 继续摘抄:Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 数据库与SQL语言 知识点总结
- 如何使用swfobject(中文版)
- 系统WallPaper图片可以设置成屏幕大小的图吗?
- java学习6:商品管理系统例子
- Activity的四种启动模式
- Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- Python 用HTMLParser解析HTML文件
- 从windows上往Linux传文件
- 645. Set Mismatch
- 16:计算线段长度
- Maven学习笔记 -- day02 Maven整合struts2及Maven核心概念、添加插件
- sqlsever 无法获得model的排它锁
- 轻装上阵Html5游戏开发,JEESJS(三)
- 细说cookie,localstorage与sessionstorage的区别