QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 932|回复: 5

redhat9.0下我为什么连接不上MYSQL数据库?

[复制链接]
发表于 2003-6-3 23:39:08 | 显示全部楼层 |阅读模式
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
请帮助我把命令行也写上好吗?
发表于 2003-6-4 09:29:03 | 显示全部楼层
你打开mysql服务没有?
回复

使用道具 举报

发表于 2003-6-4 10:37:11 | 显示全部楼层
最好建一个用户。
./safe_mysqld --user=xxx &
回复

使用道具 举报

发表于 2003-7-31 02:01:13 | 显示全部楼层
我也是有同样的错误,希望有解决方法
回复

使用道具 举报

发表于 2003-8-1 11:50:29 | 显示全部楼层
这个问题主要提示是,不能通过'/tmp/mysql.sock'连到服务器,而php标准配置正是用过'/tmp/mysql.sock',但是一些mysql安装方法将mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通过修改/etc/my.conf文件来修正它,打开文件,可以看到如下的东东:
[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';
回复

使用道具 举报

发表于 2003-8-27 20:54:23 | 显示全部楼层
应该是你的服务器没有打开吧!在命令行输入setup,然后选择其中的服务!如果实在还是不行的话,那你最好 的就是去下载两个rpm包进行安装,那就肯定不会有问题的了!但是记得还是要先启动服务!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 02:19 , Processed in 0.093941 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表