<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yousri&#039;s Blog &#187; mysql.sock</title>
	<atom:link href="http://blog.yousri.org/tag/mysql-sock/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yousri.org</link>
	<description>一个人骑单车在陌生城市路上自由穿梭的生活</description>
	<lastBuildDate>Fri, 20 Jan 2012 15:01:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’</title>
		<link>http://blog.yousri.org/2009/02/23/mysql-error-2002-mysqlsock.html</link>
		<comments>http://blog.yousri.org/2009/02/23/mysql-error-2002-mysqlsock.html#comments</comments>
		<pubDate>Mon, 23 Feb 2009 07:50:45 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql.sock]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=302</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;不幸遇到Mysql出现ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误导致无法启动 解决方法： 修改/etc/my.conf: [client] socket=/var/lib/mysql/mysql.sock [mysqld] socket=/var/lib/mysql/mysql.sock &#160;&#160;&#160;&#160;&#160;&#160;&#160;这样mysqld 及mysql就都可以搞定启动起来啦/// &#160;&#160;&#160;&#160;&#160;&#160;&#160;不过问题也就来了，php程序链接数据库的时候同样还是会出现这个问题，因为这还需要修改/etc/php.ini的php配置文件中的mysql.default_socket的值，其默认的时候是为空的，将其修改设置为： mysql.default_socket=/var/lib/mysql/mysql.sock &#160;&#160;&#160;&#160;&#160;&#160;&#160;但是有时这样并未能搞定php链接数据库的出现的Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) 的问题，因为php程序很BT的貌似非得找链接/tmp/mysql.sock而这个文件是不存在的，好吧，那就给他做个链接操作不就得了 ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock &#160;&#160;&#160;&#160;&#160;&#160;&#160;这样php程序页面就可以链接到数据库啦！！！ 附： ls -l /var/lib/mysql/mysql.sock 看到的属性是： srwxrwxrwx 1 mysql mysql 0 11-21 14:39 /var/lib/mysql/mysql.sock &#160;&#160;&#160;&#160;&#160;&#160;&#160;档案类型标志是s,还真没去了解过这样的类型。。。。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F10%2F12%2Fsetting_mysql.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">配置Mysql实现远程操作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F11%2F05%2Ferror18.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Error18:Select cylinder exceeds maximum supported by BIOS</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F08%2F06%2Flamp.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ubuntu 8.04里LAMP手动编译安装架构纪录</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F09%2Fgoogle_friend_connect_error.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">今天你Google Friends Connect 显示正常了么</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不幸遇到Mysql出现ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误导致无法启动<br />
解决方法： 修改/etc/my.conf:</p>
<pre lang="mysql">
[client]
socket=/var/lib/mysql/mysql.sock
[mysqld]
socket=/var/lib/mysql/mysql.sock
</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这样mysqld 及mysql就都可以搞定启动起来啦///<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不过问题也就来了，php程序链接数据库的时候同样还是会出现这个问题，因为这还需要修改/etc/php.ini的php配置文件中的mysql.default_socket的值，其默认的时候是为空的，将其修改设置为：</p>
<pre lang="mysql">
mysql.default_socket=/var/lib/mysql/mysql.sock
</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;但是有时这样并未能搞定php链接数据库的出现的Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) 的问题，因为php程序很BT的貌似非得找链接/tmp/mysql.sock而这个文件是不存在的，好吧，那就给他做个链接操作不就得了</p>
<pre lang="bash">
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这样php程序页面就可以链接到数据库啦！！！<br />
附：</p>
<pre lang="bash">ls -l /var/lib/mysql/mysql.sock</pre>
<p>看到的属性是：</p>
<pre lang="bash">
srwxrwxrwx 1 mysql mysql 0 11-21 14:39 /var/lib/mysql/mysql.sock
</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;档案类型标志是s,还真没去了解过这样的类型。。。。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F10%2F12%2Fsetting_mysql.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">配置Mysql实现远程操作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F11%2F05%2Ferror18.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Error18:Select cylinder exceeds maximum supported by BIOS</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F08%2F06%2Flamp.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ubuntu 8.04里LAMP手动编译安装架构纪录</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F09%2Fgoogle_friend_connect_error.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F23%2Fmysql-error-2002-mysqlsock.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">今天你Google Friends Connect 显示正常了么</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/23/mysql-error-2002-mysqlsock.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

