My code was working all fine yesterday and today it suddenly just don't want to connect to my database. I have changed no settings on it or on the code and I haven't updated any software either. All I do is this:
new PDO('mysql:host=localhost;port=3306;dbname=test', 'username', 'password');
And I get a nice exception message saying this:
Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in ...
The thing is: I'm clearly not trying to connect using a unix socket but using TCP/IP. What am I doing wrong? Is there something I'm missing here?
Thanks for any help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…