BYO database driven websites chapter 4 "unable to connect to database"


I’m at chapter 4 in Kevin Yank’s book and can’t connect to server. I keep getting this error:

Warning: mysqli_connect(): [2002] No such file or directory (trying to connect via unix://tmp/mysql.sock) in /Library/WebServer/Documents/connect/index.php on line 2 Warning: mysqli_connect(): (HY000/2002): No such file or directory in /Library/WebServer/Documents/connect/index.php on line 2
Unable to connect to the database server.

No idea what it means…

Ok so I went out came home and now it works.

BAM! Computers need rest too!

My guess is it wasn’t the “rest” but more likely a reboot of the server. (Assuming you forgot to restart it after making changes).

Anyway it’s good to hear your got it working. IMHO getting everything installed and working together can be the hardest part of the book. It seems that one fix that works for a lot of people doesn’t work for a lot of others. It’s like everyone has their own problems each requiring a unique solution.

ARRGGGH!!! Me no like installing! But I love writing code :slight_smile: