会员控制台 会员登陆 会员注册 最后更新 高级搜索 会员投稿 退出登陆
设为首页
收藏本站
留言给我
  首页 | 操作系统类 | 程序设计类 | 数据库类 | 应用服务类 | 网络及硬件类 | 其他技术 | GBunix论坛
操作系统类
程序设计类
数据库类
应用服务类
网络及硬件类
其他技术
Unix中文 / 数据库类 / Mysql / 解决不能通过mysql.sock连接MySQL问题的办法
解决不能通过mysql.sock连接MySQL问题的办法
2004-08-09    Djzhi    中文PHP论坛    点击:
解决不能通过mysql.sock连接MySQL问题的办法
这个问题主要提示是,不能通过'/tmp/mysql.sock'连到服务器,而php标准配置正是用过'/tmp/mysql.sock',但是一些mysql安装方法将mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通过修改/etc/my.cnf文件来修正它,打开文件,可以看到如下的东东:

[mysqld]
socket=/var/lib/mysql.sock

改一下就好了,但也会引起其他的问题,如mysql程序连不上了,再加一点:

[mysql]
socket=/tmp/mysql.sock

或者还可以通过修改php.ini中的配置来使php用其他的mysql.sock来连,这个大家自己去找找。

或者用这样的方法:

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

还有:

phpmyadmin的说明书有说

The error message "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)..." is displayed. What can I do?

For RedHat users, Harald Legner suggests this on the mailing list:

On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line
mysql.default_socket = /tmp/mysql.sock
change it to
mysql.default_socket = /var/lib/mysql/mysql.sock
Then restart apache and it will work.

Here is a fix suggested by Brad Ummer in the phpwizard forum:

First, you need to determine what socket is being used by MySQL.
To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin.

Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example).

Then, you need to tell PHP to use this socket.

Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.

For example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

了解更多详情,参与讨论,请进入GBUNIX论坛

http://www.gbunix.com/bbs/index.php
责任编辑: trotter

相关文章
CVS的常用命令速查手册 - 01-19 08:41 pm - 点击: 4294
如何配置和使用SSH验证的CVS服务器 - 01-18 05:09 pm - 点击: 1221
使用 Subversion 来代替 CVS - 01-18 10:49 am - 点击: 2868
Subversion 比 CVS 更好用 - 01-18 10:44 am - 点击: 1356
CVS服务器建立和权限配置 - 08-14 12:54 am - 点击: 1409
cvs服务器的安装 - 06-29 10:24 pm - 点击: 2508
CVS服务器的安装与管理 - 06-11 02:29 pm - 点击: 3970

发表评论 查看评论 加入收藏 Email给朋友 打印本文
给该文章评分
1 2 3 4 5 6 7 8 9 10
平均得分 0, 共 0 人评分
1 2 3 4 5 6 7 8 9 10
发表评论
标题:
内容:
声明:本站资讯均来自互联网,所有文章版权归原作者和出版者所有,如涉及版权问题,请来信告知!
Copyright © 2002-2004 GBunix.com. All rights reserved.