如何更改mysql.sock? [英] How to change mysql.sock?

查看:268
本文介绍了如何更改mysql.sock?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过二进制安装安装了mysql,并按照以下步骤进行操作 http://dev.mysql.com/doc/refman/5.0/en/binary-installation.html

I have installed mysql through binary installation and followed below steps http://dev.mysql.com/doc/refman/5.0/en/binary-installation.html

现在,当启动mysql服务时,sock文件将存储在/tmp/mysql.sock上.

Right now sock files are craeted on /tmp/mysql.sock when mysql service is started.

我想知道需要编辑哪些配置文件才能更改mysql.sock的路径

I want to know which configuration files need to be edited to change the path of mysql.sock

我尝试了以下步骤,将mysql.sock路径从/tmp/mysql.sock更改为/var/lib/mysql/mysql.sock

I tried the following steps to change mysql.sock path from /tmp/mysql.sock to /var/lib/mysql/mysql.sock

1.我试图在/etc/my.cnf中输入套接字路径

1.I tried to enter socketpath in /etc/my.cnf

socket =/var/lib/mysql/mysql.sock

2./etc/init.d/mysql

2./etc/init.d/mysql

basedir=/var/lib/mysql
datadir=/var/lib/mysql/data
socket=/var/lib/mysql/mysql.sock

任何人都可以帮助我解决此问题.

Can anybody help me to fix this issue.

推荐答案

在my.cnf中设置这些变量应该可以正常工作(在本地测试,Ubuntu 10.10).

Setting these variables in my.cnf should work just fine (Tested locally, Ubuntu 10.10).

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

确保您要重新启动MySQL Service吗?

Just make sure you're restarting MySQL Service?

以下是我所做的,这是在Fedora上进行的(由于您使用的是RHEL,因此应该更模仿您的设置):

Below is what I did, this is on Fedora (Since you're using RHEL this should more mimic your setup):

[root@rudi /]# ls /var/lib/mysql/
ibdata1  ib_logfile0  ib_logfile1  mysql  mysql.sock
[root@rudi /]# ls /var/run/mysqld/
mysqld.pid
[root@rudi /]# nano /etc/my.cnf 
[root@rudi /]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@rudi /]# ls /var/lib/mysql/
ibdata1  ib_logfile0  ib_logfile1  mysql
[root@rudi /]# ls /var/run/mysqld/
mysqld.pid  mysql.sock

我唯一更改的是这次socket=,重新启动仍然可以正常工作.

The only thing that I changed was socket= this time, and restarting still worked fine.

确定要在my.cnf[client]部分中未编辑socket吗?它必须在[mysqld]部分下.

Are you sure that you're not editing socket within the [client] section of my.cnf? It must be under the [mysqld] section.

这篇关于如何更改mysql.sock?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆