开发者

Cannot connect to local database

I have apache and mysql set up on my local machine (Mac).

Wheneve开发者_如何学Cr I go to any of my local sites I get the "Error establishing a database connection" whenever anything mySql related happens.

It was working perfectly yesterday, but when I started my computer today it is not.

I can login to mysql on the terminal and that all works fine, I can view database and run queries in the terminal. Look at all my table etc.

I've tried restarting apache.

Anyone know what's up? This is worrying.

UPDATE...

It is somthing in my php.ini file, if I restore the default one it all works fine and dandy again. What in there could be doing it?


The problem was in php.ini, I needed to set:

mysql.default_socket = /path_to_file/mysql.sock


I know this isn't an answer to the specific question, but it is rather a suggesting IF you are just doing development on your box. I would suggest skipping all the configurations and go with MAMP

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜