hey guys im trying to learn laravel and im following the tutorail but i cant seem to connect to my database via VM running LAMP. I've looked thru every single post and nothing is still working
when i go run the command php artisan migrate
i get the following error
[PDOException]
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '10.0.1.22' (111)
i even followed this post and got the following error
[PDOException]
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)
my laravel app is running on port 8000
but my phpmyadmin is at 10.0.1.22/phpmyadmin
im not sure if that could be the issue, im still a beginner so my debugging solutions are limited.
Here are my database.php
file and my .envi
file
database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '10.0.1.22'),
'database' => env('DB_DATABASE', 'task'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'test'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
and my .envi file
APP_ENV=local
APP_DEBUG=true
APP_KEY=HBzhX830sIrNbZ2hdB23DGAuGa4mj4IL
DB_HOST=10.0.1.22
DB_DATABASE=task
DB_USERNAME=root
DB_PASSWORD=test
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
thanks for all the help