最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
启动MYSQL提示:Can’t connect to MySQL through socket ‘/tmp/mysql.sock’
时间:2013-05-10 编辑:简简单单 来源:一聚教程网
启动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 Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement. |
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 |
ok,mysqld可以启动了
接下来,是mysql启动不了,同样,vim /etc/my.cnf,添加了如下脚本:
[mysql]
代码如下 | 复制代码 |
socket=/var/lib/mysql/mysql.sock |
然后,mysqladmin启动不了,还是一样,在[mysqladmin]下面socket值设置为同样的路径
ok,可以启动了
相关文章
- mysql下mysqladmin日常管理命令总结(必看篇) 07-25
- 查看当前mysql使用频繁的sql语句(详解) 07-11
- 对MySql经常使用语句的全面总结(必看篇) 07-11
- 关于mysql init_connect的几个要点总结 07-10
- MySQL外键约束的禁用与启用命令 07-06
- Python使用pymysql小技巧 06-07