Access denied for user 'homestead'@'localhost' (using password: YES)



PHP Snippet 1:

mysql> show variables like '%sock%';
+-----------------------------------------+-----------------------------+
| Variable_name                           | Value                       |
+-----------------------------------------+-----------------------------+
| performance_schema_max_socket_classes   | 10                          |
| performance_schema_max_socket_instances | 322                         |
| socket                                  | /var/run/mysqld/mysqld.sock |
+-----------------------------------------+-----------------------------+
3 rows in set (0.00 sec)

PHP Snippet 2:

DB_HOST=localhost
DB_DATABASE=laravelu
DB_USERNAME=root
DB_PASSWORD=''

PHP Snippet 3:

php artisan config:clear

PHP Snippet 4:

        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'blog'),
        'username'  => env('DB_USERNAME', 'root'),
        'password'  => env('DB_PASSWORD', ''),

PHP Snippet 5:

        'host'      => 'yourHostName',
        'database'  => 'YourDatabastName',
        'username'  => 'YoutDatabaseUsername',
        'password'  => 'YourDatabasePassword',

PHP Snippet 6:

APP_ENV=local
APP_DEBUG=true
APP_KEY=someRandomNumber

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null

PHP Snippet 7:

DB_HOST=yourHostName
DB_DATABASE=yourDatabaseName
DB_USERNAME=yourDatabaseUsername
DB_PASSWORD=youPassword

PHP Snippet 8:

grant all privileges on *.* to 'homestead'@% identified by 'secret';

PHP Snippet 9:

DB_HOST=192.168.10.10
DB_DATABASE=homestead
DB_USERNAME=homestead

PHP Snippet 10:

php artisan serve

PHP Snippet 11:

[PDOException] SQLSTATE[HY000] [2002] No such file or directory

PHP Snippet 12:

php artisan config:clear. 

PHP Snippet 13:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=user_name
DB_PASSWORD='password'

PHP Snippet 14:

php artisan config:clear

PHP Snippet 15:

 php artisan serve

PHP Snippet 16:

APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PHP Snippet 17:

$ homestead ssh

$ mysql -u root -p

Enter password: secret

mysql> grant all privileges on *.* to 'homestead'@'localhost' identified by 'secret';

Query OK, 0 rows affected (0.00 sec)
exit

PHP Snippet 18:

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

PHP Snippet 19:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

PHP Snippet 20:

$ touch database/database.sqlite
$ php artisan tinker
Psy Shell v0.8.0 (PHP 5.6.27 — cli) by Justin Hileman
>>> database_path(‘database.sqlite’)
=> "/Users/connorleech/Projects/laravel-5-rest-api/database/database.sqlite"

PHP Snippet 21:

DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=/Users/connorleech/Projects/laravel-5-rest-api/database/database.sqlite
DB_USERNAME=homestead
DB_PASSWORD=secret

PHP Snippet 22:

vagrant ssh