PHP Snippet 1:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
PHP Snippet 2:
mysql -u root -p
PHP Snippet 3:
mysql> show variables like '%sock%'
PHP Snippet 4:
+-----------------------------------------+-----------------+
| Variable_name | Value |
+-----------------------------------------+-----------------+
| performance_schema_max_socket_classes | 10 |
| performance_schema_max_socket_instances | 322 |
| socket | /tmp/mysql.sock |
+-----------------------------------------+-----------------+
PHP Snippet 5:
/tmp/mysql.sock
PHP Snippet 6:
'unix_socket' => '/tmp/mysql.sock'
PHP Snippet 7:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'SchoolBoard',
'username' => 'root',
'password' => 'venturaa',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'unix_socket' => '/tmp/mysql.sock',
),
PHP Snippet 8:
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
PHP Snippet 9:
pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock
PHP Snippet 10:
pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
PHP Snippet 11:
'mysql' => array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'port' => '8889',
'database' => 'databaseName',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
PHP Snippet 12:
sudo service mysqld start
PHP Snippet 13:
homestead ssh
PHP Snippet 14:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
PHP Snippet 15:
'mysql' => [
'driver' => 'mysql',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '8889'),
PHP Snippet 16:
mkdir /var/mysql
ln -s /tmp/mysql.sock /var/mysql/mysql.sock
PHP Snippet 17:
unix 2 [ ACC ] STREAM LISTENING 17397 /var/run/mysqld/mysqld.sock
PHP Snippet 18:
'mysql' => array(
'driver' => 'mysql',
'host' => '67.25.71.187',
'database' => 'dbname',
'username' => 'username',
'password' => '***',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'unix_socket' => '/var/run/mysqld/mysqld.sock' <-----
),
),
PHP Snippet 19:
'port' => '1234',
'unix_socket' => '/path/to/my/socket/mysqld.sock'
PHP Snippet 20:
DB_HOST=db
PHP Snippet 21:
service mysqld restart
PHP Snippet 22:
service httpd restart
PHP Snippet 23:
DB_HOST=db
PHP Snippet 24:
mysql> show variables like '%sock%'
PHP Snippet 25:
+-----------------------------------------+-----------------------------+
| Variable_name | Value |
+-----------------------------------------+-----------------------------+
| mysqlx_socket | /var/run/mysqld/mysqlx.sock |
| performance_schema_max_socket_classes | 10 |
| performance_schema_max_socket_instances | -1 |
| socket | /var/run/mysqld/mysqld.sock |
+-----------------------------------------+-----------------------------+
4 rows in set (0.00 sec)
PHP Snippet 26:
'mysql' => array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => 'database_name',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'unix_socket' => '/var/run/mysqld/mysqld.sock',
),
PHP Snippet 27:
DB_HOST=127.0.0.1
DB_DATABASE=db1
DB_USERNAME=user1
DB_PASSWORD=pass1
PHP Snippet 28:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
PHP Snippet 30:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_DATABASE', 'homestead'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
PHP Snippet 31:
vm
vagrant@homestead:~/Code/projectFolder php artisan migrate:install
PHP Snippet 32:
SQLSTATE[HY000] [2002] No such file or directory
PHP Snippet 33:
SQLSTATE[HY000] [2002] Connection refused
PHP Snippet 34:
[mysqld]
# skip-networking
PHP Snippet 35:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=
PHP Snippet 36:
DB_CONNECTION=mysql
DB_HOST=127.0.01
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=
PHP Snippet 37:
php artisan config:clear
php artisan migrate:install
php artisan migrate
PHP Snippet 38:
if($_SERVER['HTTP_HOST'] == "localhost")
PHP Snippet 39:
if($_SERVER['HTTP_HOST'] == "localhost" || $_SERVER['HTTP_HOST'] == "127.0.0.1")