mysql不指定sock无法登录_解决不能通过mysql.sock连接MySQL问题

[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'; (T113)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值