启动MYSQL提示:Can’t connect to MySQL through socket ‘/tmp/mysql.sock
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-08 13:08:15 浏览: 评论:0
本文章来给大家介绍在启动MYSQL时突然启动不了,查看日志发现提示:Can’t connect to MySQL through socket ‘/tmp/mysql.sock’,后来百度了两种解决办法,有需要的朋友可参考。
启动MYSQL是出现以下错误:
- [root@www ~]# /usr/local/webserver/mysql/bin/mysqladmin -u root -p 12345678
- Enter password:/usr/local/webserver/mysql/bin/mysqladmin: connect to server at ‘localhost’ failed
- error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (111)’
- Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!
解决方法,代码如下:
- [root@www ~]# /usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 3
- Server version: 5.1.38-log Source distribution
- Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
- --phpfensi.com
- mysql>
mysql的参数说明:/usr/local/webserver/mysql/bin/mysql –help | less
列举常用参数:
-u,–user=name User for login if not current user.
-p,–password[=name]
Password to use when connecting to server. If password is not given it’s asked from the tty.
-S,–socket=name Socket file to use for connection.
另一种解决办法,我通过vim /etc/my.cnf,修改了[mysqld]选项下面的socket的值,代码如下:
socket=/var/lib/mysql/mysql.sock
mysqld可以启动了,接下来,是mysql启动不了,同样,vim /etc/my.cnf,添加了如下脚本:
- [mysql]
- socket=/var/lib/mysql/mysql.sock
然后,mysqladmin启动不了,还是一样,在[mysqladmin]下面socket值设置为同样的路径,可以启动了.
Tags: Can’t connect MySQL through
相关文章
- ·Mysql出现Can’t connect to MySQL server on ‘localhost’ (10061)问题(2014-09-23)
- ·MySQL下“Can’t create/write to file xxx (Errcode: 13)”错误(2014-09-27)
- ·MYSQL提示 max_open_files: 2048 max_connections: 800 table_cache: 619(2014-09-23)
- ·Mysql "Too many connections"错误解决办法(2014-09-24)
- ·解决MySql Error:Host is blocked because of many connection errors问题(2014-09-24)
- ·Can t connect to mysql server on localhost (10061) 错误(2014-09-24)
- ·Warning:mysql_connect() [function.mysql-connect]: [2002] 由于目标机器.(2014-09-25)
- ·ERROR 1040: Too many connections问题解决办法(2014-09-28)
- ·Cant Connect MySQL Server(localhost:3306)问题(2014-09-28)
- ·MySql Lost connection to MySQL server during query问题(2014-09-28)
- ·mysql ERROR 1040: Too many connections(2014-10-02)
- ·MySQL连接too many connection错误并且启动时间特别长(2014-10-04)
- ·Mysql “Too many connections” 的解决方法(2014-10-04)
- ·Can t connect to local MySQL server through socket /tmp/mysql.sock(2014-10-08)
- ·mysql_connect() 不支持 请检查 mysql 模块是否正确加载(2014-10-08)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)