0

My connection database localhost in env file is like this :

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=chelsea
DB_USERNAME=root
DB_PASSWORD=terry

It's using database local

I want access localhost using database server

I change the connection in env file to be like this :

DB_CONNECTION=mysql
DB_HOST=31.220.56.75
DB_PORT=3306
DB_DATABASE=chelsea
DB_USERNAME=root
DB_PASSWORD=terry

Then, I access my localhost, there is exist error like this :

QueryException in Connection.php line 769: SQLSTATE[HY000] [1045] Access denied for user 'root'@'114.121.233.117' (using password: YES) (SQL: select * from `users` where `users`.`deleted_at` is null)

Is there any people who can help me?

samuel toh
  • 6,836
  • 21
  • 71
  • 108
  • If you're using correct credentials, you want to [grant remote access to MySQL DB](https://easyengine.io/tutorials/mysql/remote-access/) – Alexey Mezenin Dec 14 '16 at 04:44
  • your server need confirm for allow remote connect http://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql – dungphanxuan Dec 14 '16 at 04:44
  • 1
    @dungphanxuan even though that answer is highly voted i would suggest from refraining use of `'root'@'%'`. better try giving/using remote access to some lesser privileged user. – bansi Dec 14 '16 at 04:53

1 Answers1

1
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=yourdatabasename
DB_USERNAME=root
DB_PASSWORD=
Borna
  • 538
  • 4
  • 19