# Can't connect to local MySQL server through socket

**URL:** <https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server-through-socket/162031>\
**Category:** Rails\
**Created:** [March 5, 2009, 2:05am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server-through-socket/162031 "2009-03-05T02:05:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [March 5, 2009, 2:05am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server-through-socket/162031/1 "2009-03-05T02:05:39Z")

</div>

I just did an unwanted mysql upgrade and am now unable to start the  
mysql service.

After doing some searching the common solution is to just create a  
symlink  
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

The issue for me is I don’t have the file I am trying to symlink to  
(/var/run/mysqld/mysqld.sock)

If I try to start mysql manually (mysql start) I get the error:

# mysql start

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket  
‘/var/run/mysqld/mysqld.sock’ (2)

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [March 5, 2009, 2:35am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server-through-socket/162031/2 "2009-03-05T02:35:04Z")

</div>

On Wed, Mar 4, 2009 at 5:05 PM, Chris O. \<  
removed\_email\_address@domain.invalid\> wrote:

> If I try to start mysql manually (mysql start) I get the error:
> 
> # mysql start
> 
> ERROR 2002 (HY000): Can’t connect to local MySQL server through socket  
> ‘/var/run/mysqld/mysqld.sock’ (2)

Hi, are you 100% sure that you need the location of this .sock file? If  
you  
do, then generate another Rails project and take a look at the  
database.yml  
file.

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [March 5, 2009, 2:35am UTC](https://www.ruby-forum.com/t/cant-connect-to-local-mysql-server-through-socket/162031/3 "2009-03-05T02:35:50Z")

</div>

After running the proper command /etc/init.d/mysql start it then  
informed me that a log expiry must be set for the current configuration.

It is a little odd that the default configurations don’t work, but it is  
working for me now so I am happy.
