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