0
我在ENV文件连接数据库,本地主机是这样的:如何使用数据库服务器访问本地主机?
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=chelsea
DB_USERNAME=root
DB_PASSWORD=terry
它使用数据库的本地
我使用数据库服务器
希望获得本地主机更改在ENV文件中的连接是这样的:
DB_CONNECTION=mysql
DB_HOST=31.220.56.75
DB_PORT=3306
DB_DATABASE=chelsea
DB_USERNAME=root
DB_PASSWORD=terry
然后,我访问我的本地主机,存在像这样的错误:
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)
有没有人可以帮助我?
如果你使用正确的凭据,要[授予MySQL数据库的远程访问(https://easyengine.io/tutorials/mysql/remote-access/) –
您的服务器需要确认允许远程连接http://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql – dungphanxuan
@dungphanxuan即使答案是高度投票,我会建议从禁止使用''根'@' %“'。更好地尝试给/使用远程访问权限较低的特权用户。 – bansi