XAMPP or MAMP – Can’t connect to mysql

You’ll need to update your DB config file…

What worked for me was adding this:

'mysql' => [
 'driver' => 'mysql',
 'host' => env('DB_HOST', 'localhost'),
 'database' => env('DB_DATABASE', 'db_name'),
 'username' => env('DB_USERNAME', 'db_user'),
 'password' => env('DB_PASSWORD', 'db_password'),
 'unix_socket' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock',
 'charset' => 'utf8',
 'collation' => 'utf8_unicode_ci',
 'prefix' => '',
 'strict' => false,
 'options' => [
 #PDO::MYSQL_ATTR_MAX_BUFFER_SIZE => 16777216
 PDO::MYSQL_ATTR_LOCAL_INFILE => true
 ]
],

Here’s one other solution:

I was getting some similar error and ended up here. I am using OSX 10.9.5. This solved my problems (hope it helps someone).

1) sudo mkdir /var/mysql
2) sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock

More informations: http://glidingphenomena.blogspot.com.br/2010/03/fixing-warning-mysqlconnect-cant.html

Thanks!

NOTE: Replace /var/mysql/mysql.sock with the path to your actual mysql.sock file (w XAMPP, it would be /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock)

WordPress + Xampp on Mac Update Permissions Problem | A different story…

WordPress + Xampp on Mac Update Permissions Problem | A different story….

To perform the requested action, WordPress needs to access your web server.

[OT] Enable ‘user’ dir in Mac OS X (/Users/*/[user]/* → http://localhost/~[user]/*) notes:

https://community.apachefriends.org/f/viewtopic.php?f=29&t=69163&p=247767#p247767

 

The solution: Edit your httpd.conf to run as your username for the user and staff for the group.

Open httpd.conf in TextEdit:

sudo open -e /Applications/XAMPP/xamppfiles/etc/httpd.conf

Change:

User nobody
Group nogroup

To:

User your_mac_username
Group staff

How to nuke attackers via httpd.conf?

How to nuke attackers via httpd.conf?That can be accomplished using mod_access “Deny from <envar>” with mod_setenvif testing REQUEST_URI or by using mod_rewrite:

RewriteRule (awstats.pl¦xmlrpc.php¦includer.cgi¦hints.pl)$ - [F]

Of course, the problem is that you’ll still be wasting bandwidth sending your custom 403 error page to these idiots.A work-around (stay with me here) is to do the following:Create a new subdirectory below web root.Place a custom 403 error page in that subdirectory. Lets call it “403.html” for now. Leave out all the HEAD content, and just put a few characters in this file, so you can recognize it by filesize when fetched — I use just the text “No.”Now create an .htaccess file in that subdirectory that contains the following:

ErrorDocument 403 /path_to_this_subdirectory/403.html
Options +FollowSymLinks
RewriteEngine onRewriteRule !^403.html$ - [F]

Now, instead of the first code snippet I posted above, use the following in httpd.conf or in your web root .htaccess file:

RewriteRule (awstats.pl¦xmlrpc.php¦includer.cgi¦hints.pl)$ 
/path_to_subdirectory/$1 [L]

Now when a bad-bot attempts to fetch one of those files, it gets rewritten to the subdirectory. But no files in that subdirectory are allowed to be fetched except for 403.html. So, the 403 error handler is invoked, and returns only a 403-Forbidden server response header and the three-byte response from 403.html, thus minimizing your bandwidth loss.

Authenticate Apache 2 using Mac OS X Open Directory

macosxhints.com – Authenticate Apache 2 using Mac OS X Open Directory

Change this:

cn=user1,dn=example,dn=com

to this:

uid=user1,dn=example,dn=com

so it looks like this:

AuthType Basic
AuthName "Testing of LDAP auth"
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPBindDN uid=testaccount1,cn=users,dc=geo,dc=vuw,dc=ac,dc=nz
AuthLDAPBindPassword [plaintext password for user 'testaccount1']
AuthLDAPURL ldap://server1.geo.vuw.ac.nz/dc=geo,dc=vuw,dc=ac,dc=nz
require valid-user

Clear as mud? 😉