vendredi 24 juin 2016

SQLSTATE[HY000] Connection refused

I tried to get Laravel working on a remote server. But when I ran the "php artisan migrate" command it responds with:

[PDOException]
SQLSTATE[HY000]  [2002] Connection refused

I Google'd for solutions and so far I tried:

  • Disable .env by renaming it to .env.off;
  • Setting up the database credentials directly into database.php;
  • Adding port 3306;
  • The DB user has all privileges;
  • Tried running it as 'localhost', 127.0.0.1 and remote IP;
  • Running a plain PHP PDO connection, it connects;
  • When I used the remote IP it says "Acces Denied for user 'daniel..."

.env

APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:[secret]=
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=daniel
DB_USERNAME=daniel
DB_PASSWORD=4K^2N(h}%V&S

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

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

database.php

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', 'localhost'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'daniel'),
    'username' => env('DB_USERNAME', 'daniel'),
    'password' => env('DB_PASSWORD', '4K^2N(h}%V&S'),
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
    'strict' => false,
    'engine' => null,
],



from Newest questions tagged laravel-5 - Stack Overflow http://stackoverflow.com/questions/38025870/sqlstatehy000-connection-refused
via IFTTT

Aucun commentaire:

Enregistrer un commentaire