Friday, May 17, 2013

Fix mysql.sock connection problem PHP, MySQL in Mac Mountain Lion

I was setting up a PyroCMS site on my Mac (Mountain Lion) and I had this error:

A Database Error Occurred
Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 1191

So I followed the instruction of this forum: http://ellislab.com/forums/viewthread/207916/
Changing the 'db_debug'  => true, to false on the database.php file.

After doing this I tested again the site and this errors appear:

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 0

Filename: core/MY_Controller.php

Line Number: 97

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 0

Filename: core/MY_Controller.php

Line Number: 113

An Error Was Encountered [ 500 ]
Unable to load the requested language file: language//choice_lang.php

So I kept on searching and then I found this link: http://stackoverflow.com/questions/4219970/warning-mysql-connect-2002-no-such-file-or-directory-trying-to-connect-vi/7264459#7264459

I didn't have /var/mysql/mysql.sock file, so I followed the instructions:

If you have /tmp/mysql.sock but no /var/mysql/mysql.sock then...

cd /var 
mkdir mysql
cd mysql
ln -s /tmp/mysql.sock mysql.sock

If you have /var/mysql/mysql.sock but no /tmp/mysql.sock then

cd /tmp
ln -s /var/mysql/mysql.sock mysql.sock

You will need permissions to create the directory and link, so just prefix the commands above with sudo if necessary.

And it works!

2 comments:

  1. Did you hear there's a 12 word phrase you can tell your partner... that will trigger deep feelings of love and instinctual attractiveness to you deep inside his chest?

    Because deep inside these 12 words is a "secret signal" that fuels a man's impulse to love, please and care for you with all his heart...

    12 Words Will Fuel A Man's Love Impulse

    This impulse is so hardwired into a man's brain that it will make him work better than before to build your relationship stronger.

    Matter-of-fact, fueling this influential impulse is absolutely mandatory to getting the best possible relationship with your man that once you send your man one of these "Secret Signals"...

    ...You'll instantly notice him open his mind and heart for you in a way he's never expressed before and he will distinguish you as the only woman in the world who has ever truly fascinated him.

    ReplyDelete
  2. Water Hack Burns 2lb of Fat OVERNIGHT

    More than 160 000 men and women are utilizing a easy and secret "water hack" to burn 1-2lbs each and every night as they sleep.

    It's very easy and works every time.

    Here are the easy steps for this hack:

    1) Get a glass and fill it half the way

    2) Proceed to do this strange HACK

    and you'll be 1-2lbs thinner in the morning!

    ReplyDelete