How to fix Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
Apparently, Mac OS X doesn't allow for PHP MySQL connection out of the box. You get this:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
OR In CakePHP
Warning: Could not connect to Database.
I found the most clear fix here:
/etc/php.ini(.default) looks for mysql.sock in the wrong place... two options are to make a symbolic link from the right place to the socket...
sudo mkdir /var/mysql
sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock
Or you can update your php.ini (.default) by finding "mysql.default_socket" and setting it to equal /private/tmp/mysql.sock and then restart apache web server
Subscribe to:
Post Comments (Atom)
Python contextlib for Timing Python code
If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...
-
If you get the following error while installing FFMPEG or other packages on CentOS 7. Requires: libva.so.1(VA_API_0.33.0)(64bit) Follow...
-
Common error: fallocate: fallocate failed: Text file busy in ubuntu OS Check the allocation: free -m or sudo swapon --show Make sure ...
-
How to fix Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' Apparently, Ma...
No comments:
Post a Comment